The Python development team has released the latest version of Python 3.10. This includes more new features, security patches, and many other improvements. This version includes a new feature that is “Parenthesized context managers”. Using enclosing parentheses for continuation across multiple lines in context managers is now supported. For more details read the complete changelog.
This tutorial will help you with the installation of Python 3.10 on Debian 11/10 Linux systems. The tutorial will compile and install Python 3.10 source code on your system.
First of all, Log in to your Debian-based system with sudo privileged account access. Open a terminal (CTRL+ALT+T) and execute the below commands to update packages.
sudo apt update && sudo apt upgrade
Then install the required packages for the compilation of Python source code.
sudo apt install wget build-essential libncursesw5-dev libssl-dev \ libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev
Install Python 3.10 on Debian
The default Debian repositories contain older Python versions only. So this tutorial will use Python source code for installation on Debian 10 system.
Follow the below steps to install Python 3.10 on Debian:
- Download Python – You can directory download Python 3.10 source archive from its official site.
- Extract Archive – After downloading, extract the archive file on your system.
tar xzf Python-3.10.2.tgz
- Compiling Python Source – Change to the extracted directory with cd command, then prepare the Python source code for the compilation on your system.
- Install Python 3.10 – Finally, run the following command to complete the Python installation on Debian system. The
altinstallprevents the compiler to override default Python versions.
Wait for the Python installation to complete on your system.
Check Python Version
At this step, you have successfully installed Python 3.9 on Debian 10 system. You need to type
python3.9 to use this version. For example, to check the Python version, execute:
python3.10 -VPython 3.10.2
This will also install pip for Python 3.10.
pip3.10 -Vpip 21.2.4 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)
That’s it, You have successfully installed Python 3.10 on Debian 11 and Debian 10 systems.
In this tutorial, you have learned to install Python 3.10 on Debian Linux systems using source code. You can try Python examples via command line.