Python is a high-level, object-oriented and multipurpose programming language that is extremely popular thanks to its simple and easy-to-learn syntax. It is widely used in various IT disciplines such as data analytics and visualization, web development, gaming development, AI, and machine learning. Python 3.10 is the latest major and stable release and was released on October 04, 2021. Before we install Python 3.10 on Debian 11, let us have a preview of major features and enhancements that come with it.
- Structural Pattern Matching Specification
- Improved Error Reporting
- Precise line numbers for debugging
- offers parameter specification variables
- Strict Arguments for zip function
- Parenthesized Context Managers
In this article, we will demonstrate how to install Python 3.10 on Debian 11.
Step 1: Install Dependencies
First off, install the essential dependencies required for building Python 3.10 from source as we shall later see.
$ sudo apt update
$ sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev
With all the dependencies in place, let’s now download the latest Python version.
Step 2: Download Python 3.10
Next, head over to the Python 3.10 download page . Here, you will find the latest features of the latest upgrade including the changelog, documentation, and source files for all computing platforms. Download the Gzipped source tarball file using the wget command as shown.
$ wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz
Once the download of the tarball file is complete, proceed and extract it as shown.
$ tar -xvf Python-3.10.0.tgz
This will yield an uncompressed folder containing all the source code files required to build and install Python 3.10
Step 3: Build and Install Python 3.10 on Debian 11
Now we are ready to install Python 3.10 on Debian 11. First, navigate into the python 3.10 directory.
$ cd Python-3.10.0
Then execute the configure
command to confirm if all the dependencies for the installation of Python 3.10 are met.
$ sudo ./configure --enable-optimizations
The -–enable-optimizations
flag optimizes the Python binary and executes multiple tests. To start the
build process. Execute the following make
command. This takes quite a while, so be patient.
$ sudo make -j 2
The value ‘2′ represents the number of CPU cores that can be confirmed using the nproc
command. Adjust this value according to the number of CPU cores present on your system.
$ nproc
Finally, run the command below to install python binaries once the build process is complete:
$ sudo make altinstall
Step 4: Verify Python 3.10 installation
Once the installation is complete, verify that python 3.10 is installed in your machine. Run:
$ python3.10 --version
The output confirms that we have been able to install Python 3.10 on Debian 11 Bullseye. As you have witnessed the installation is quite simple and straightforward. We hope that this guide was helpful.