How To Install Python 3.11 on Debian 11

This guide intends to teach you How To Install Python 3.11 on Debian 11.

Python is a popular general-purpose programming language that can be used for a wide variety of applications. It includes high-level data structures, dynamic typing, dynamic binding, and many more features that make it as useful for complex application development as it is for scripting or “glue code” that connects components together.

It can also be extended to make system calls to almost all operating systems and to run code written in C or C++. Due to its ubiquity and ability to run on nearly every system architecture, Python is a universal language found in a variety of different applications.

Python 3.11 is the new release of Python and includes many new features and improvements.

Steps To Install Python 3.11 on Debian 11

To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with Debian 11.

Install Python 3.11 on Debian 11

At this step, you will learn to install Python from the source.

First, you need to update your local package index with the following command:

sudo apt update

Then, you need to install the required packages and dependencies on Debian 11 with the command below:

sudo apt install -y build-essential libncurses5-dev zlib1g-dev libnss3-dev libgdbm-dev libssl-dev libsqlite3-dev libffi-dev libreadline-dev curl libbz2-dev

Download Python 3.11

Now download Python 3.11 latest gzipped source code file from the Official Python release with the wget command:

sudo wget

Next, extract your downloaded file with the following command:

sudo tar -xvf Python-3.11.1.tgz

Build and Install Python 3.11

To compile Python 3.11 from the source navigate to the uncompressed folder on Debian 11 with the command below:

cd Python-3.11.1

After that, run the configure script as shown below:

./configure --enable-optimizations

This runs multiple tests and takes quite some time.

Then, you need to start the build process with the command below:

make -j 2

The -j option specifies the number of CPU cores. You can check out the number of cores on your Linux system by using the following command:


This will take some time to complete the build process.

Debian Install python 3.11

When you are done,  run the following command to install Python binaries:

sudo make altinstall

This will take some time to complete.

At this point, you can verify your Python 3.11 installation:

python3.11 --version
Python 3.11.1

Access Python 3.11 Shell on Debian 11

At this point, you can access your Python 3.11 shell with the following command:


Now you can write a simple program to find the sum of two variables, x, and y to test your program:

x = 35

y = 75

z = x + y

print("Hello, the sum of x and y is", +z)

In your output you will see:

Hello, the sum of x and y is 110


At this point, you have learned to Install Python 3.11 on Debian 11.

Hope you enjoy it.

You may be like these articles:

How To Install PostgreSQL 15 on Debian 11

Install and Configure OpenLiteSpeed on Debian 11

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!