How To Install Python 3.13 on Debian 12 / Debian 11

There are many programming languages available to use. They are used by developers as a way to build programs used by computers to perform their tasks. They are mainly used to develop desktop applications, websites, and mobile applications. Knowing which programming language to use depends on the efficiency offered by each one of them. There are two types of programming languages:

  • Low-level Programming Language that is machine-dependent. The languages can be run without the need for a compiler or an interpreter which means that the programs written in this language run fast.
  • High-level Programming Language requires a compiler or interpreter to translate the program into machine language to execute the program. They are used to develop user-friendly applications as they are also easy to read, write and maintain. They include Java, Python, and C#.
  • Middle-level Programming Language stands between the high and low levels with support for developing user-friendly applications but is also closely related to machine language. This level includes C and C++ languages.

Python is one of the most popular Programming languages that is user-friendly and easy to learn. It is most widely used in Machine learning, Artificial intelligence, Big Data, GUI-based desktop applications, and Robotics. It can also be used in frontend and backend development, web robotization, PC vision, and code testing. It integrates with other programming languages like C, Java, and C++. The advantage of Python when debugging is that it is easy to find an error as it executes code line by line. It is also platform-independent and which means that you can write code once and run it anywhere.

The latest release of Python is 3.13 which is an upgrade to Python 3.12. It includes new and improved features like;

  • An enhanced interactive interpreter built on top of PyPy that offers colorized exception tracebacks, multi-line editing, and color support.
  • An experimental free-threaded build mode that permits threads to operate more concurrently by turning off the Global Interpreter Lock. The Windows and macOS installers also offer the build mode as an experimental feature.
  • An experimental, preliminary JIT that lays the foundation for notable performance gains.
  • Debuggers can now work more consistently with the locals() builtin function (and its C equivalent) since it has well-defined semantics while modifying the returned mapping.
  • Now included is a modified version of mimalloc, which is necessary for the free-threaded build mode and optional but enabled by default if the platform supports it.
  • The leading indentation of docstrings has been removed, which lowers memory usage and the size of.pyc files. (The majority of docstring handling utilities already remove the leading indentation.)
  • When new files are created, the new dbm.sqlite3 backend from the dbm module is used by default.
  • 10.13 (High Sierra) is now the minimum supported macOS version instead of 10.9 as before. In the future, older macOS versions will not be supported.

This guide is going to install Python 3.13 on Debian 12 / Debian 11.

1. Install Python 3.11 on Debian 12 / Debian 11

Update your system to the latest packages with the following command.

sudo apt update && sudo apt upgrade -y

Perform a reboot after:

[ -f /var/run/reboot-required ] && sudo reboot -f

Install the required dependencies to install Python from the source code.

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 -y

Download Python 3.13 from the Downloads page or use the wget utility to do so.

wget https://www.python.org/ftp/python/3.13.1/Python-3.13.1.tar.xz

extract the downloaded tarball using the following command:

tar -xvf Python-3.13.1.tar.xz

Change to the extracted directory, and start the compilations.

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

Then build and install Python with the following command.

sudo make altinstall

2. Set Python 3.13 as Default

If you had an older version of Python3 and you would want to set Python 3.13 as a default, create a symbolic link to Python3 with the following command.

sudo update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.13 1

Now test for the version.

$ python3 --version
Python 3.13.1

3. Install Python Modules

Python Modules can be installed with Python Package manager(PIP). Install PIP using the following command if you do not have it.

curl -sS https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py 

Check for the pip version to confirm successful installation.

$ pip3.13 --version
pip 24.3.1 from /usr/local/lib/python3.13/site-packages/pip (python 3.13)

Install the modules with the following command syntax.

python3.13 -m pip install <ModuleName>

Or

pip3.13 install <ModuleName>

To install a package isolated to a specific user, use the following command syntax.

python3.13 -m pip install --user <ModuleName>

Let us try to install the Flask module.

python3.13 -m pip install flask

Then check the details of the module with the following command.

$ python3.13 -m pip show flask
Name: Flask
Version: 3.1.0
Summary: A simple framework for building complex web applications.
Home-page:
Author:
Author-email:
License:
Location: /home/cloudspinx/.local/lib/python3.13/site-packages
Requires: blinker, click, itsdangerous, Jinja2, Werkzeug
Required-by:

To upgrade a module, use the following command.

$ python3.13 -m pip install --upgrade flask
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: flask in ./.local/lib/python3.13/site-packages (3.1.0)
Requirement already satisfied: Werkzeug>=3.1 in ./.local/lib/python3.13/site-packages (from flask) (3.1.3)
Requirement already satisfied: Jinja2>=3.1.2 in ./.local/lib/python3.13/site-packages (from flask) (3.1.5)
Requirement already satisfied: itsdangerous>=2.2 in ./.local/lib/python3.13/site-packages (from flask) (2.2.0)
Requirement already satisfied: click>=8.1.3 in ./.local/lib/python3.13/site-packages (from flask) (8.1.8)
Requirement already satisfied: blinker>=1.9 in ./.local/lib/python3.13/site-packages (from flask) (1.9.0)
Requirement already satisfied: MarkupSafe>=2.0 in ./.local/lib/python3.13/site-packages (from Jinja2>=3.1.2->flask) (3.0.2)

To uninstall a module:

$ python3.13 -m pip uninstall flask
Found existing installation: Flask 3.1.0
Uninstalling Flask-3.1.0:
  Would remove:
    /home/cloudspinx/.local/bin/flask
    /home/cloudspinx/.local/lib/python3.13/site-packages/flask-3.1.0.dist-info/*
    /home/cloudspinx/.local/lib/python3.13/site-packages/flask/*
Proceed (Y/n)? Y
  Successfully uninstalled Flask-3.1.0

4. Sample Python Program on Debian

Invoke the Python Interpreter with the following command.

$ python3.13
Python 3.13.1 (main, Jan  7 2025, 09:01:33) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

Enter the following code then press Enter which gives an output of the statement.

>>> print("Hello, My fellow Pythonistas!")
Hello, My fellow Pythonistas!

You can also use Python as a calculator. Try running the following expressions to get a value.

>>> 3+8
11
>>> 2*7
14
>>> 60/5
12.0

Conclusion

Python programming language is an open-source programming language that lets you work quickly and integrate systems more effectively. It has an elegant syntax and dynamic typing that makes it an ideal language for scripting and rapid application development in many areas on most platforms.

Your IT Journey Starts Here!

Ready to level up your IT skills? Our new eLearning platform is coming soon to help you master the latest technologies.

Be the first to know when we launch! Join our waitlist now.

Join our Linux and open source community. Subscribe to our newsletter for tips, tricks, and collaboration opportunities!

Recent Post

Leave a Comment

Your email address will not be published. Required fields are marked *

Related Post

Virtualization is the creation of a virtual version of something, this is achieved by allowing hardware components of a single […]

A database is a collection of structured data that is organized in such a way that can be easily accessed, […]

Arch Linux is an independently developed Linux distribution that is lightweight and simple to use. It aims to keep its […]

Let's Connect

Unleash the full potential of your business with CloudSpinx. Our expert solutions specialists are standing by to answer your questions and tailor a plan that perfectly aligns with your unique needs.
You will get a response from our solutions specialist within 12 hours
We understand emergencies can be stressful. For immediate assistance, chat with us now

Contact CloudSpinx today!

Download CloudSpinx Profile

Discover the full spectrum of our expertise and services by downloading our detailed Company Profile. Simply enter your first name, last name, and email address.