Python is one of the most popular high-level languages, focusing on high-level and object-oriented applications from simple scrips to complex machine learning algorithms.
Some of the features Python can do:
- Python can be used on a server to create web applications.
- Python can be used alongside software to create workflows.
- Python can connect to database systems. It can also read and modify files.
- Python can be used to handle big data and perform complex mathematics.
- Python can be used for rapid prototyping or production-ready software development.
The Python language was created by Guido van Rossum and released in 1991, Python 2 in 2000 and Python 3 in 2008. Currently, the latest series in Python is 3.9. Major Python update brings a faster release schedule and performance boosts handy new string functions, dictionary union operators, and more consistent and stable internal APIs. Python 3.9, released today, brings forward significant changes to language features and how the language is developed.
In our guide, we will install Python 3.9 from the source, as the standard Debian 10 repositories do not come with the latest stable version of Python instead of ships with 3.7.
Table of Contents
Install Python 3.9 From Source Code
First, check for updates and upgrade your system.
sudo apt update && upgrade -y
Install the required packages to configure and build the Python 3.9 source code.
sudo apt install wget build-essential libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev -y
Download Python 3.9
Next, go to Python 3.9’s download page and get the latest version. Currently, this is 3.9.5 in June 2021. Then go to the directory you successfully downloaded Python 3.9 to.
Now we will need to extract to gzipped archive.
tar -xf Python-3.9.5.tgz
Then proceed to open the directory and configure the install.
cd Python-3.9.5 && ./configure --enable-optimizations
Note, “–enable-optimizations” optimizes the Python library by running multiple tests during the build install, making sure all dependencies are present on your system and resulting in a stable install. The downside is that it’ll take time.
Build Python 3.9
You will now, after successfully configuring Python 3.9, now you build it by the following command.
make -j 4
The make “-j” command number is the number of cores in your processor that your system. You can find this out by typing the following command.
Now with the build process completed, you can install the Python 3.9 Libraries by the following command.
sudo make altinstall
The “altinstall” prevents the compiler from overriding default Python versions.
Congratulations, you have installed Python 3.9 on your Debian 10 Buster system. We can check the version by executing the following command.
An example output:
Comments and Conclusion:
The guide has shown you how to configure and build your Python version on your Debian 10 system. You will need to make sure you keep updating it as with all self-made builds, and updates, especially around security, can be forgotten about without checking in the future, so best to subscribe to a Python RSS feed or similar to keep up with the news and updates.