You can’t install Python 3.9 from the standard Debian 10 repositories. However, you can install it from the python source.
This tutorial will cover the installation procedure Python 3.9 on the Linux system Debian 10 through the command line. All commands we will implement in the Debian 10 Terminal application. Therefore. Open the terminal application by pressing ‘Ctrl+Alt+t’ or open it directly from the Debian 10 installed applications and start the installation!
Note: All steps we will run under the Sudo privileges.
Installation of python on Debian 10
Python installation is a very straightforward and relatively simple process that you can complete in a few minutes by following the below-mentioned steps:
Step 1: Installing necessary packages or dependencies
First, you need to install all packages and dependencies required to build the python source. Therefore, to install all the required packages, type the below-mentioned command:
libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev
Step 2: Download Python Release
In this step, you will download the latest python release from the python download page. To do this, use the ‘curl’ or ‘wget’ command to download the python release. To our best knowledge, the latest release of python at the time of article writing is 3.9. So, grab this release by executing the following command:
Step 3: Extract the tar file
Once the download process is completed. The downloaded file will save into the .tar extension. So, you need to extract this file by using the following command:
Step 4: Navigate and execute the configuration script
Navigate into the following python directory:
Now, by executing the following command, run the below-mentioned configuration script to prepare your system for python source code compilation:
The above script will perform several checks to ensure that all of the dependencies are installed on your system. The ‘–enable-optimizations’ is used here to optimize the Python binary by executing many tests.
Step 5: Install python
Now, start the build process by running the below-mentioned command:
You will modify -j according to your processor’s cores. To find the number by typing the ‘nproc’ command.
Once the above build process is completed, run the following command to install python binaries on your system:
Never use ‘make install’ to install the binaries because it will overwrite the binary of python 3.
Python is installed on your system, Debian 10. You can check the installation of python 3.9 by running the following command:
Or
Conclusion
We have shown in this article how you can install Python 3.9 on Debian 10 Linux system. We have explained each step-in detail. By executing the steps mentioned earlier, you can easily install the latest Python release on your system. You can get more information about the python language from various internet resources. Thanks for reading this tutorial.