More specifically, Python 3.9 is embedded with new syntax, built-in, standard library features, new library modules, and Interpreter improvements.
This write-up will discuss the procedure to install Python 3.9 on Ubuntu 22.04 using two different methods. So, let’s start!
To install Python on Ubuntu 22.04 with APT, you must follow the below-given step-by-step instructions.
Step 1: Update system repositories
Press “CTRL+ALT+T” to open the terminal of the Ubuntu 22.04 and run the below-given command to update system repositories:
Step 2: Install prerequisite package
The next step is about the installation of the “software-properties-common” package:
Step 3: Add “deadsnakes” PPA
After fulfilling all of the prerequisites, move ahead and add the “deadsnakes” PPA to your system source list:
Step 4: Python 3.9 installation on Ubuntu 22.04
Now, execute the below-given command for installation of Python 3.9 on your Ubuntu 22.04 system:
Enter “y” to permit the installation process to continue:
Step 5: Verify Python version
Lastly, execute the “python3.9” command with the “–version” option to verify the installed version of Python:
As you can see, the given output signifies that we have successfully installed Python 3.9 on our Ubuntu 22.04:
Now, let’s check out the second method for the installation of Python 3.9 on Ubuntu 22.04.
Installing Python from source has its advantages as it permits you to install the most latest Python version and tweak the build options. To avail this method, follow the below-given procedure.
Step 1: Install required dependencies
Firstly, utilize the given command for the installation of the required dependencies for Python 3.9:
After executing the above command, wait for a few minutes:
Step 2: Download compressed Python 3.9 package
Next, utilize the below-given “wget” command for downloading Python 3.9 compressed package:
Step 3: Extract Python 3.9 package
Now, use the “tar” command to extract the content of the Python 3.9 downloaded compressed file:
Step 4: Start building Python 3.9
To start building Python 3.9 on your Ubuntu 22.04 system, firstly, move to the “Python-3.9.7/” directory by utilizing the “cd” command:
Then, start the “configure” script and add the “–enable-optimizations” option for optimizing the Python binary:
After doing so, execute the “make” command for starting the Python 3.9 building process:
After completing the build process, write out the following command for installing the Python 3.9 binaries:
Step 5: Verify Python version
Now, execute the “python3.9” command with the “–version” option to verify the installed version of Python:
As you can see, the given output signifies that we have successfully installed Python 3.9 on our Ubuntu 22.04:
To remove Python 3.9 from Ubuntu 22.04, type out the following command:
We have compiled two different methods for installing Python 3.9 on Ubuntu 22.04.
To install Python 3.9 on Ubuntu 22.04, you can use both APT and compressed Python 3.9 source file. By using APT, firstly, install the prerequisites and execute the “$ sudo apt install python3.9” command. While installing Python 3.9 from source, you have to download and install the Python 3.9 package and then build the Python binaries. This write-up discussed two methods for the installation of Python 3.9 on Ubuntu 22.04.
The latest interim release of Ubuntu introduces “devpacks” for popular frameworks like Spring, along with…
Ubuntu 25.04, codenamed “Plucky Puffin”, is here. This release continues Ubuntu’s proud tradition of integrating…
Ubuntu released its 20.04 (Focal Fossa) release 5 years ago, on March 23, 2020. As…
Focal Fossa will reach the End of Standard Support in May 2025, also known as…
Ubuntu MATE 25.04 is ready to soar! 🪽 Celebrating our 10th anniversary as an official…
Welcome to the Ubuntu Weekly Newsletter, Issue 887 for the week of April 6 –…