In this tutorial, we will explain how to install Python on the latest stable version of Debian 13. Python is a high-level programming language widely used due to its readability and ease of use. Python offers a variety of features and supports object-oriented and functional programming. It is used in machine learning, data science, web development, and automation processes, among others. The latest Python version at the time we were writing this blog post was Python 3.13, and we will cover its installation via multiple methods.
Installing Python is a straightforward process that takes a couple of minutes, depending on the method used. Let’s get started!
Table of Contents
Prerequisites
- A server running Debian 13 OS
- User privileges: root or non-root user with sudo privileges
Update the system
Before we start with the installation of Python 3.13, we will update the packages to their latest available versions. To do that, execute the following command:
sudo apt update -y && sudo apt upgrade -y
Install Python 3.13 with APT
By default, the Python 3.11 version is included in the Debian 13 repository. We assume that you have freshly installed Debian 13 and there are no Python versions on it. The fastest and easiest way to install Python 3.11 is by executing the following command:
sudo apt install python3 -y
Once installed, check the Python 3 version with the command below:
python3 -V
You should get an output similar to this:
root@host:~# python3 -V Python 3.13.5
Install Python 3.14 from Source
Installing Python 3.14 from source involves downloading the original code of the program, optimizing it, and compiling it into an executable program on the server. This includes building from source, which provides flexibility in customization and access to the latest stable version.
As you noticed in the previous step, we installed Python 3.13 via APT because it is the default Python version included in the Debian 13 repository. This step is independent of the previous one, and if you want to install the latest version from source, you can use this one, but before we proceed with installation, we need to install the Python 3 prerequisites:
sudo apt install build-essential libnss3-dev libssl-dev wget libreadline-dev libffi-dev pkg-config zlib1g-dev libncurses5-dev libgdbm-dev -y
Once the prerequisites are installed, let’s download Python 3.14 and proceed with the building process:
cd /opt wget https://www.python.org/ftp/python/3.14.0/Python-3.14.0a1.tgz
Once downloaded, extract the file.
tar -xf Python-3.14.0a1.tgz
Enter the Python directory:
cd Python-3.14.0a1/
Enable the Python 3.14 optimizations with the ./configure script for faster code execution:
./configure --enable-optimizations
The optimization process will start, and below you can see what the first and the last lines of the process:
root@host:/opt/Python-3.14.0a1# ./configure --enable-optimizations checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking for Python interpreter freezing... ./_bootstrap_python checking for python3.14... no checking for python3.13... no checking for python3.12... no checking for python3.11... no checking for python3.10... no checking for python3... no checking for python... no checking Python for regen version... missing checking for pkg-config... /usr/bin/pkg-config checking pkg-config is at least version 0.9.0... yes . . . . . configure: creating ./config.status config.status: creating Makefile.pre config.status: creating Misc/python.pc config.status: creating Misc/python-embed.pc config.status: creating Misc/python-config.sh config.status: creating Modules/Setup.bootstrap config.status: creating Modules/Setup.stdlib config.status: creating Modules/ld_so_aix config.status: creating pyconfig.h configure: creating Modules/Setup.local configure: creating Makefile
Once done, we are ready to proceed with the build and installation process with the command below:
sudo make altinstall
The installation process will begin, and you should allow approximately 30 minutes for it to complete.
root@host:/opt/Python-3.14.0a1# sudo make altinstall gcc -c -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fno-semantic-interposition -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -Werror=implicit-function-declaration -fvisibility=hidden -I./Include/internal -I./Include/internal/mimalloc -I. -I./Include -DPy_BUILD_CORE -o Programs/python.o ./Programs/python.c . . . .
Once the installation is complete, you should receive the following output:
Looking in links: /tmp/tmpo50y2_cg Processing /tmp/tmpo50y2_cg/pip-24.2-py3-none-any.whl Installing collected packages: pip Successfully installed pip-24.2
To verify the installation is successful, execute the following command:
python3.14 -V
How to remove the Python version from your server?
Removing the Python version depends on how you installed it. If you installed it via the APT, you can completely remove the Python version by executing the following command:
apt purge python3* -y
Removing the Python version installed from source can be done by removing the installation folder and the symbolic link. The symbolic link can be found with the command below:
which python3.14
You should receive output similar to this:
/usr/local/bin/python3.14
So, to remove the Python 13 installed via source in our example would be:
rm -rf /opt/Python-3.14.0a1/ rm /usr/local/bin/python3.14
Conclusion
These are the two ways of installing Python on Debian 13. Installation via APT and from source are currently supported ways. The third option would be to install from the PPA (Personal Package Archive), but Debian 13 does not natively support PPAs as Ubuntu does. The PPAs are not directly compatible with Debian due to differences in their package management system. So, using PPAs on Debian can lead to conflicts.
That’s it. You successfully installed Python 13 on Debian 13 in two different ways.
Of course, you don’t have to install Python 13 on Debian 13 if you have difficulties and you are not familiar with Linux. You can always contact our technical support. You only need to sign up for one of our Linux Python hosting plans and submit a support ticket. We are available 24/7 and will attend to your request promptly.
If you liked this post about installing Python on Debian 13, please share it with your friends or leave a comment down below.