🧣How To Install Python 3.11 on Ubuntu 22.04|20.04|18.04 | ComputingForGeeks
| 2023-6-21
0  |  0 分钟
Jun 21, 2023 09:35 AM
This guide demonstrates how to install Python 3.11 on Ubuntu 22.04|20.04|18.04 Linux machine.
Programming plays a huge role in the tech world. Without it, you wouldn’t be able to view this article or use your phone, computer, smart TV etc. In this technology-driven world, learning programming can really give you a competitive edge. This can help innovate and create solutions for the global society.
Programming can be defined as a set of instructions given to a computer to execute. These instructions are written in language that the computer understands. Today there are many programming languages, the most common ones are Java, JavaScript, Ruby, Python, C/C++, Swift e.t.c.
Python is an open-source, high-level object-oriented programming language with a large community. It is one of the most considered languages for beginners. This is mainly because of its simplicity and easy-to-learn syntax. It is used to build a wide range of applications from small and simple scripts to complex machine-learning algorithms. Python is mainly used for:
  • Rapid prototyping or production-ready software development.
  • Create web applications on servers
  • Handling big data and performing complex mathematics.
  • Connect to database systems, read and modify files.
  • Alongside software to create workflows
The latest release of Python is Python 3.11 made on October 24, 2022. This faster and more user-friendly version has been made available after seventeen months of development. This has resulted in several features and improvements being tagged to it.
The main features associated with Python 3.11 are:
  • Faster code execution due to considerable effort in the Faster CPython project
  • Better error messages with more informative tracebacks
  • Task and exception groups that simplify working with asynchronous code
  • Native TOML support for working with configuration files
  • Several new typing features that improve Python’s static typing support
  • A More powerful Python parser
  • Security updates

Install Python 3.11 on Ubuntu 22.04|20.04|18.04

This guide demonstrates how to install Python 3.11 on Ubuntu 22.04|20.04|18.04 Linux machine.
This guide will provide two methods to get Python 3.11 installed on Ubuntu 22.04|20.04|18.04. The two methods are:
  • Installing from the deadsnakes PPA
  • Manually build Python 3.11 from the source code
But before we proceed, ensure that the system packages are updated to their latest available versions:
Now choose one of the method that best works for you.

Method 1 – Install Python 3.11 on Ubuntu from deadsnakes PPA

The deadsnakes PPA provides the simplest method to install Python 3.11 on Ubuntu 22.04|20.04|18.04. It also enables users to receive continued updates, bug fixes, and security updates. A big thumbs up to this custom PPA!
First, install the required dependency packages:
Add the deadsnakes PPA to the APT package manager sources list.
Proceed as shown:
Press Enter to continue. Once the PPA has been added, you can install Python 3.11 on Ubuntu using the commands:
Verify the installation:

Method 2 – Install Python 3.11 on Ubuntu from source.

This is an alternative method of installing Python 3.11 on Ubuntu Linux system. With this method, you are guaranteed the latest Python Version. The only problem with this method is that you will not be able to receive continued updates, bug fixes, and security updates through the APT package manager.
Begin by installing the packages required to build Python 3.11 from the source.
Once the packages have been installed, download the latest available Python 3.11 gzipped tarball from the Python official release page.
You can still download the tarball using wget:
Extract the downloaded archive:
Now navigate into the directory:
We will check if the required dependencies are met and optimize the binary with the command:
Sample Output:
Once checked, start the build process with the command below. We have used -j to provide the number of cores available on the system, this makes the build process faster:
Sample Output:
Note: Building Python from source can take a long time, depending on your system. You can adjust the number passed to the -j option in the make command to specify the number of parallel build jobs to run, which can speed up the build process.
Once the build process is complete, install Python 3.11 with the command:
We have used altinstall is used instead of install  to keep the default Python binary path in /usr/bin/python.
Execution output:
Once complete, check the version:

Install Python Extensions

Python modules are important since they add functionality to Python. These modules can be installed using the  Python Package manager (PIP).
Install PIP on Ubuntu:
Confirm it’s installed by checking the version:
Now use PIP to install any module. The command to use has the syntax:
For example:
Sample output:
You can list all the installed modules using the command;


We have successfully gone through how to install Python 3.11 on Ubuntu 22.04|20.04|18.04. You can now use the installed Python 3.11 to build web applications, create workflows, software development etc.
See more:
Best Books for Learning Python Programming 2022 > 本文由简悦 SimpRead 转码
  • Linux
  • Python
  • 工具
  • ubuntu 安装不同版本的 python加锁文章 - 密码123456