How To Install Python 3.9 on Ubuntu 20.04

In this article, learn how to install Python 3.9 on Ubuntu 20.04.

Python is a high-level programming language that is object-oriented. It is open-source and has a significant user base. Python is a significant language utilized by leading IT businesses such as Google.

Python 3.9 has been released, which includes a number of bug fixes and security updates. It contained a number of new modules, as well as improvements to old modules and a number of other features.

On an Ubuntu 20.04 machine, you can install Python using the deadsnakes PPA.

This guide will show you how to install Python 3.9 using Apt-Get on an Ubuntu 20.04 LTS Linux machine. You can also install Python from source code using the second technique.


Open a terminal on your Ubuntu machine and install the necessary packages.

sudo apt update  sudo apt install wget software-properties-common

Installing Python 3.9 Using Apt

Install Python 3.9 on an Ubuntu Linux system using Apt, the Ubuntu package manager. Follow the instructions below:

1. By using CTRL+ALT+T, you can open a terminal and add the deadsnakes PPA to your machine.

sudo add-apt-repository ppa:deadsnakes/ppa 

2. Update the apt cache and install Python 3.9 on Ubuntu after adding the PPA to your machine.

sudo apt update  sudo apt install python3.9 

3. Allow for the installation to finish. Execute the following command to determine the Python version:

python3.9 -V 
Python 3.9.6

That concludes the discussion. Python 3.9 has been installed successfully on your Ubuntu 20.04 LTS system.

Installing Python 3.9 Using Source Code

There’s also the option of installing Python 3.9 from the source code. Installing Python 3.9 packages from source code is not recommended. However, you may need to install Python from the source code in some circumstances.

So, to install Python 3.9 from source code on an Ubuntu 20.04 Linux system, follow the steps below.

1. Install the necessary packages for compiling source code first. Open a terminal and type the commands below:

sudo apt install build-essential checkinstall 
sudo apt install libreadline-gplv2-dev libncursesw5-dev libssl-dev \
libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev 

2. Now, go to the official Python 3.9 download site and get the source code. Change to an appropriate location and download the source file with wget.

cd /opt 
sudo wget 

3. After that, unpack the downloaded archive file and prepare the installation source.

tar xzf Python-3.9.6.tgz  cd Python-3.9.6  sudo ./configure --enable-optimizations 

4. Python source code is now available for download. To install Python 3.9 on your system, run the make altinstall command.

sudo make altinstall 

make altinstall is used to prevent replacing the default python binary file /usr/bin/python.

5. On the Ubuntu 18.04 system, Python 3.9 has been installed. Check the version that’s been installed:

python3.9 -V 
Python 3.9.6

6. To free up space, delete the downloaded archive.

sudo rm -f /opt/Python-3.9.6.tgz 

In this video, we are gonna show you how to install Python 3.9 on Ubuntu 20.04:


You’ve learnt how to install Python 3.9 on Ubuntu 20.04 using Apt and source code in this article. Python examples can be run from the command line.

Loading Facebook Comments ...