How to Install Python 3.9 on Debian 11

Install Python 3.9 on Debian 11

In this article, we will have explained the necessary steps to install Python 3.9 on Debian 11. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Python is one of the most popular programming languages out there. Its incredible versatility makes it be in almost any technology field. Python 3.9 is the latest stable version available for production environments. Most of the Debian-based Linux distribution includes older versions of Python in software repositories. Also, the Debian packages are not available for all distributions.


  • Operating System with Debian 11.
  • Server IPv4 Address with Superuser Privileges (Root Access)
  • Gnome Terminal for Linux Desktop
  • PuTTy SSH client for Windows or macOS
  • Powershell for Windows 10/11
  • Familiar with APT Commands

Install Python 3.9 on Debian 11

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo apt update
sudo apt upgrade
sudo apt install wget build-essential libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev

Step 2. Install Python on Debian 11.

Download the latest version of the Python 3.9 source archive from its official website:


Then, extract the downloaded file:

tar xzf Python-3.9.7.tgz

Now access the generated folder and start the configuration:

cd Python-3.9.7
./configure --enable-optimizations

Finally, run the following command to complete the Python installation:

make altinstall

After the installation is complete, you can check exactly what versions are installed for Python 3 using the following command:

python3 --version


[email protected]:~# pip3.9 -V
pip 21.1.3 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)

To install Python modules, you need to run the following command inside your Python 3.9 directory:

python3.9 -m pip install <module>

That’s all you need to do to install the Python on Debian (Bullseye). I hope you find this quick tip helpful. For further reading Python Programming Language on Debian’s system, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.