2 Ways To Install Python 3.10 on Ubuntu 20.04 LTS (Step-by-Step Guide)


Guide: 2 Ways To Install Python 3.10 on Ubuntu 20.04

Python releases updates quite frequently and when it does there are various improvements. These are welcomed by every programmer on. 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 LTS with deadsnakes custom PPA package or build it from the original source.

Python 3.10 Latest Python 3.10 for Ubuntu 20.04Features

There are quite a lot of new and useful features added to Python 3.10 when 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 iterable passed to this function are of the same length or not.

Patterns can be easily matched

Now if you have been practicing C++ you might have wished that Python had switch statement so that you don’t need to go through long if, elif, elif,… ., else statement. It 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 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 

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:

[email protected]:~# apt install software-properties-common –y

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

[email protected]:~# 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

[email protected]:~# 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:

[email protected]:~# 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:

[email protected]:~# Wget https://www.python.org/ftp/python/3.10.6/add version here

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

[email protected]:~# Tar –xf python-3.10.*.tgz

Step 4: Now, go into extracted directory, run 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.

[email protected]:~# 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.

[email protected]:~# make altinstall

Step 8: Now, here altinstall is used inspite of install to keep 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:

[email protected]:~# apt install python3-pip

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

[email protected]:~# pip install module-name

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

[email protected]:~#pip install numpy

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 when 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 decided to go ahead, Installing Python 3.10 on Ubuntu 20.04 LTS is easy with our 2 methods. We use the deadsnakes PPA and install it from the original source. Do let us know in the comment area below which method of Python 3.10 installation you used.


Please enter your comment!
Please enter your name here