Welcome to our today’s guide on How To Install Python 3.12 on Debian 12|Debian 11. Python is created under an OSI-approved open-source license that allows for free use and distribution, including for commercial purposes. The Python Software Foundation oversees the Python license. It is one of the most well-liked programming languages and is simple to learn. The most common uses for it are in robotics, big data, machine learning, and artificial intelligence. Additionally, it is applicable to front- and back-end programming, web robotics, computer vision, and code debugging.
The most recent major update of the Python programming language, Python 3.12.0, is scheduled for release on October 2, 2023. It includes a number of improvements and new capabilities.
Table of Contents
Python 3.12 New Features
The following amazing features are included with Python 3.12;
- Python code that supports the buffer protocol.
- The Linux perf Profiler is supported.
- Additional Specializations and Inlined Comprehensions.
- Enhancements to Error Messages.
- Support for distinct global interpreter locks for isolated subinterpreters.
- A new profiling/debugging API.
- Decorator override for explicit inheritance.
- Greater F-String Power.
- Syntax for Dedicated Type Variables.
Install Python 3.12 on Debian 12|Debian 11
To install Python 3.12 on Debian 12/11, follow the procedure below.
Update Debian 12|Debian 11 System
Before we begin our installation, we are required to update and upgrade our system. Run the following command to accomplish this;
sudo apt update && sudo apt upgrade -y
Reboot the System;
sudo reboot now
Install required Dependencies on Debian 12|Debian 11
Execute the following command to install Python 3.12 dependencies;
sudo apt install -y libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev wget build-essential libreadline-dev
Download Python 3.12 Installer
Navigate to the Python 3.12 Download page to obtain the installer.
You can use the wget command to obtain the tarball;
Run the following command to extract the downloaded tarball;
tar -xvf Python-3.12.0.tar.xz
Navigate to the directory obtained after extraction;
Compile and install Python 3.12 on Debian 12|Debian 11 using the following commands;
./configure --enable-optimizations sudo make altinstall
Configure Python 3.12 as Default on Debian 12|Debian 11
Make a symbolic link to Python3 using the following command if you wish to replace a previous version of Python3 with Python 3.12 as the default;
sudo update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.12 1
Check the Python version;
Example Usage of Python 3.12 on Debian 12|Debian 11
To start using Python 3.12 on Debian 12|Debian 11, use the following command to launch the Python interpreter on your terminal;
Python 3.12.0 (main, Oct 3 2023, 21:15:20) [GCC 12.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>>
You can now run the Hello World program;
>>> print("Hello World, Python 3.12 is Amazing!") Hello World, Python 3.12 is Amazing! >>>
This concludes our guide on How To Install Python 3.12 on Debian 12| Debian 11. Enjoy using Python 3.12 for development.
Python 3.12 Documentation.