The latest version of Python as of June 25, 2022 is 3.10.5. If you have Debian 10 or 11 and would like to install it, here are steps.
Download Python 3.10.5 source
The latest Python source code is available here.
First, download and untar the latest Python source code.
cd /tmp/ wget https://www.python.org/ftp/python/3.10.5/Python-3.10.5.tgz tar -xzvf Python-3.10.5.tgz cd Python-3.10.5/
Install the build tools
Now, install the build tools.
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev
Configure, make and make install
./configure --enable-optimizations
Before running make
, find the number of processors your server has using nproc
.
nproc
You will see something like this:
2
Now, run make with the number of processors. This may take a while.
make -j 2
Make install
We will install Python under /usr/local/bin
instead of overwriting the default Python installation under /usr/bin
.
sudo make altinstall
This will install Python at /usr/local/bin/python3.10
. To test the version, run this:
python3.10 -V
You will get this output:
Python 3.10.5
Make Python 3.10.5 the default version
To make the default version of Python 3.10.5, run this:
sudo ln -s /usr/local/bin/python
sudo ln -s /usr/local/bin/python3.10 /usr/local/bin/python
Test whether Python 3.10.5 is the default version:
$ ls -al /usr/local/bin/python
lrwxrwxrwx 1 root root 25 Jun 25 12:09 /usr/local/bin/python -> /usr/local/bin/python3.10
python -V
The output will be:
Python 3.10.5
If you liked this post, please feel free to share it. If you have any problems installing Python 3.10.5 in your Debian 10/11, you may contact me.