How To Install Python 3.9 on Debian 10

Python is one of the most requested and also popular programming languages. It is a versatile language that is good for building all kinds of applications, from simple scripts to complex machine learning algorithms. Python, with its simple and easy-to-learn syntax, is a popular choice for both beginners and experienced developers. Python 3.9. 2 is the latest major version of the Python language (Updated 19 February 2021). It includes many new features such as new dict operators, new str features, IANA timezone support, and more.

Installing Python 3.9.2 on Debian 10

Compiling Python from source allows you to install the latest version of Python and customize your build options. However, you will not be able to support installing Python through the apt package manager. Building Python 3.9.2 on Debian is a relatively straightforward process that only takes a few minutes. So, the first thing to do is to install all the dependencies that will be needed in order to build Python. This can be done using the following command:

apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev

Then you need to download the latest source code from the Python download page using wget:


After successfully completing the download, you should immediately unpack the archive. This is available with the command described below:

tar -xf Python-3.9.1.tgz

Next, you need to go to your Python source directory and run configure:

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

The -enable-optimizations option optimizes the Python binary by running multiple tests. The script runs a series of checks to ensure that all dependencies are present on your system by running the Python 3.9.2 build process:

make -j 2

When the build process has successfully progressed to completion, the next step is to install the Python binaries by typing:

make altinstall

This completes the installation and initial configuration of Python. Python is ready to use, to test this, you can enter the command:

python3.9 --version

Was this article helpful?

Related Articles

Leave A Comment?