Guide: 2 Ways To Install Python 3.10 on Ubuntu 20.04/22.04/23.04

Python releases updates quite frequently and when it does there are various improvements. Every programmer welcomes these. Their latest stable release currently Python 3.10 which was back in 2021. The new release makes zipping better and code more efficient with asynchronous iteration. In this tutorial, you will learn how to install Python 3.10 on Ubuntu 20.04/22.04 LTS with deadsnakes custom PPA package or build it from the source.

Python 3.10 Latest Python 3.10 for Ubuntu 20.04Features

There are many new and useful features added to Python 3.10 compared to Python 3.

Iteration is now Asynchronous

This is a powerful yet advanced programming paradigm that has been a part of python since version 3.5. In the new version, you shall see two in-built asynchronous functions; aiter() and anext() to make your code more readable.

A new union operator is included

This is a dynamic language but there are ways in which we can make certain portions static like you are writing a function and the kind of attribute is important for communication within the function.

Zipping is better

The most loved feature is zip() which is an in-built function. Through this, you are able to combine and iterate over elements from several sequences. Now, in the last versions, you could have used it with sequences of different lengths but in the new version a parameter has been introduced, strict was, which checks whether all iterables passed to this function are of the same length.

Patterns can be easily matched

Now if you have been practicing C++ you might have wished that Python had a switch statement so that you don’t need to go through long if, elif, elif,… ., else statement. The new additional feature is structural pattern matching which is also called as switch, case.

Errors make sense

Now, for all those who use Python each day or teach coding, we know how hard and frustrating it is when you get an error code. Though such errors are easy to fix once you have a grip on both Python and programming, at times what happens is that we require error messages to locate it efficiently and also save a lot of time on debugging.

In the new version, all this is easy with better error messaging and precise line numbers for debugging.

ALSO SEE: 7 best and Free Python IDEs for Ubuntu 20.04 LTS.

2 Methods To Install Python 3.10 on Ubuntu 20.04, 22.04, 23.04

Python 3.10 can be installed via the PPA method and the normal method where we will be installing it directly from the source.

Method #1: Installing via deadsnakes custom PPA (Easier and faster)

Install Python 3.10 with deadsnakes ppa

The process of installing this is easy all hail to deadsnakes custom PPA which has made it easy to install Python to Ubuntu and get updates, bug fixes as well as updates on security. However, some people have raised questions as to if this can be trusted or not, in our case it is very safe to use and has not had any issues since first appearing.

Step 1: You need to get dependency for adding custom PPAs. This is done by enabling common properties:

Paul@ninja-ide:~# apt install software-properties-common –y

Step 2: After this you need to move forward and add dead snakes PPA to APT package manager sources list like:

Paul@ninja-ide:~# add-apt-repository ppa:deadsnakes/ppa

Step 3: Now run the command by press Enter.

Step 4: Once the repository has been added you can now download pythons new version with command line

Paul@ninja-ide:~# apt install python3.10

Step 5: To make sure the right release has been installed, you need to verify it. Below is how you can do it:

Paul@ninja-ide:~# python –version

Method #2: Installing Python 3.10 from original sources only (Recommended and Safe)

Python 3.10 Installation from Original Source

It can be installed by building it from the source. Keep in mind that in this you shall get the version but shall not receive continued updates, bug fixes as well as security updates via the APT package manager.

This is deemed much safer as you are pulling directly from the source. You can check the Setup and Building page in their official Developer’s Guide.

Step 1: From the source, you need to install the required dependencies to build Python 3.10:

Step 2: After this you need to download the latest version from Python’s official release page. As an alternate what you can do is also download Python 3.10 in a gzipped tarball and use Wget to pull it or you can use cURL. Will make sense below:

Paul@ninja-ide:~# Wget version here

Step 3: Once the file has been downloaded simply extract it.

Paul@ninja-ide:~# Tar –xf python-3.10.*.tgz

Step 4: Now, go into the extracted directory, run the configure script and check on the required dependencies. The –enable optimization flag is able to optimize binary by different tests.

Step 5: Now you need to initiate the build process.

Paul@ninja-ide:~# Make –j $(nproc)

Step 6: Just keep in mind that the –j argument needs to match with core numbers on our system for the process to be fast. You need to check the no. of codes that are present on your system using the command nproc. We have 2 cores on our system.

Step 7: As the build process has been completed you now need to issue the make command below to get it.

Paul@ninja-ide:~# make altinstall

Step 8: Now, here altinstall is used in spite of install to keep the default Python binary path in /usr/bin/python.

All done, you have now successfully installed Python 3.10 on Ubuntu 20.04 LTS.

Recommended: Install Python 3 PIP Package

Both of these are useful as they are able to add in functions to Python. These can be installed on Ubuntu using Python Package Manager (PIP). You simply need to have PIP installed on your system.

Step 1: Install PIP:

Paul@ninja-ide:~# apt install python3-pip

Step 2: After this use the following syntax to install Python module of your personal choice.

Paul@ninja-ide:~# pip install module-name

Step 3: We shall demonstrate how to install the Python module: numpy.

Paul@ninja-ide:~#pip install numpy

Update: The above steps are confirmed to be also working on Ubuntu 22.04.

Free Python scripts you can use:

  1. Send Free SMS Messages with Python SMS Sender Script.
  2. Predict Upcoming Weather with Python code.
  3. Create your own Python Hacking project with free scripts.


Python 3.10 brings various improvements compared to previous releases such as 3.8 and 3.9. Having said that it is not important that you upgrade, but only if the new features appeal to you. If you decide to proceed, Installing Python 3.10 on Ubuntu 20.04/22.04/23.04 LTS is easy with our 2 methods. We use the deadsnakes PPA and install it from the source. In the comment area below, let us know which method of Python 3.10 installation you used.

Previous article7 Best Fastest Linux Distros for Old Laptops, Developers & Gaming 2024
Next articleTop 5 Python Code Vulnerability Scanners: Keep your Code Secure
Paul Carruthers
Paul is an avid programmer who specializes in Python and Java with over 16 years of experience in the field. He loves automating complex tasks and creating useful scripts to streamline work and make life easier. He is also a massive fan of Linux and currently uses it as his main desktop OS. When he is not staring at code, he loves hiking and swimming in different parts of the world.


Please enter your comment!
Please enter your name here