[ad_1]
Python is one of the world’s most popular programming languages. It is a versatile language used to build all kinds of applications, from simple scrips to complex machine learning algorithms. With its simple and easy to learn syntax, Python is a popular choice for beginners and experienced developers.
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 IANA time zone, and more
.
In this article, we’ll show you how to install Python 3.9 on Debian 10.
Debian 10 ships with Python 3.7, which can be installed or updated using the apt
tool.
Installing Python 3.9 on Debian 10
Compiling Python from the source allows you to install the latest Python version and customize the build options. However, you won’t be able to maintain your Python installation through the apt
package manager.
Building Python 3.9 on Debian is a relatively straightforward process and will only take a few minutes.
-
Install the dependencies necessary to build Python:
sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev curl libbz2-dev
-
Download the latest release’s source code from the Python download page
withwget
:wget https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz
-
Once the download is complete, extract the gzipped archive
:tar -xf Python-3.9.1.tgz
-
Navigate
to the Python source directory and execute theconfigure
script:cd Python-3.9.1
./configure --enable-optimizations
The
--enable-optimizations
option optimizes the Python binary by running multiple tests. This makes the build process slower.The script runs a number of checks to make sure all of the dependencies on your system are present:
-
Start the Python 3.9 build process:
make -j 2
For faster build time, modify the
-j
to correspond to the number of cores in your processor. You can find the number by typingnproc
. -
When the build process is complete, install the Python binaries by typing:
sudo make altinstall
We’re using
altinstall
instead ofinstall
because later will overwrite the default system python3 binary.
That’s it. Python 3.9 has been installed and ready to be used. To verify it, type:
python3.9 --version
The output should show the Python version:
Python 3.9.1
Conclusion
We’ve shown you how to install Python 3.9 on your Debian 10 system. You can now create a virtual environment and start developing your Python projects.
If you have any questions or feedback, feel free to comment below.
[ad_2]
Source link