Python on Ubuntu: Install or Upgrade to the Latest Version | Install Python on Ubuntu from Source
Learn how to install Python on Ubuntu using source code in this easy-to-follow steps!
Whether you're a beginner or a seasoned developer, this guide has everything you need to get started.
We cover:
Updating your system
Installing essential tools and libraries
Downloading and building Python from source
Cleaning up unnecessary files
Commands and steps are available in the description for your convenience.
Update the system
sudo apt update && sudo apt upgrade -y
Install required tools and libraries
sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev \
libssl-dev libsqlite3-dev libreadline-dev libffi-dev wget curl libbz2-dev
_____________________________
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev wget
Download the Python source code
wget https://www.python.org/ftp/python/X.Y...
(Replace X.Y.Z with your desired Python version (e.g., 3.12.3))
Extract the downloaded tarball
tar -xf Python-X.Y.Z.tgz
Configure Python for your system
./configure --enable-optimizations
Build and install Python
sudo make altinstall
Clean up unnecessary files
cd ..
rm -rf Python-X.Y.Z Python-X.Y.Z.tgz
Don’t forget to like, share, and subscribe to Geek Guy for more awesome content! Stay curious and keep coding!