How to Install Python 3.9 on Debian 10

How to Install Python 3.9 on Debian 10

In this article, we will have explained the necessary steps to install and set up Python on 3.9 on Debian 10. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Python is a free, open-source, and one of the most popular programming languages around the world. It is used in multiple ways to build different kinds of applications. Python 3.9 is the latest major release of the Python language. It includes many new features such as new dict operators, new str functions, support for the IANA time zone, and more.

Install Python 3.9 on Debian 10

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo apt update
sudo apt upgrade
sudo apt install software-properties-common apt-transport-https gnupg2

Step 2. Install Python 3.9 on the Debian system.

  • Install Python 3.9 via PPA.

Now add the third-party PPA with the following command below:

add-apt-repository ppa:deadsnakes/ppa

Once the repository is added, update the repository cache and install the Python 3.9:

sudo apt update
sudo apt install python3.9

That’s it. Python 3.9 has been installed and ready to be used. To verify it, type:

python3.9 --version
  • Install Python 3.9 via the official source.

Now download Python 3.9 source archive from its official site:

wget https://www.python.org/ftp/python/3.9.4/Python-3.9.4.tgz

After that, extract the archive file on your system:

tar xzf Python-3.9.4.tgz

Next, compiling Python source using the following command:

cd Python-3.9.4 
./configure --enable-optimizations

Finally, run the following command to complete the Python installation on the Debian system:

make altinstall

Once the installation is completed, you can verify the installed version of Python with the following command:

python3.9 -V

That’s all you need to do to install the Python on Debian 10 Buster. I hope you find this quick tip helpful. For further reading on Python 3.9, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.