Install/Upgrade Python 3.10 on Linux Mint 20 LTS

Python is one of the most popular high-level languages, focusing on high-level and object-oriented applications from simple scrips to complex machine learning algorithms. Some of the features Python can do:

  • Python can be used on a server to create web applications.
  • Python can be used alongside software to create workflows.
  • Python can connect to database systems. It can also read and modify files.
  • Python can be used to handle big data and perform complex mathematics.
  • Python can be used for rapid prototyping or production-ready software development.

In the following tutorial, you will learn how to installPython 3.10 on Linux Mint 20 LTS.

Update Linux Mint System

Update your Linux Mint operating system to make sure all existing packages are up to date:

sudo apt update && sudo apt upgrade -y

Next, proceed to install Python 3.10 using one of the two installation methods below.

Install Python 3.10 – APT Method

To install the latest versions of Python 3.10 is a relatively straightforward process, thanks to custom PPAs. To install and receive continued updates for new features, bug fixes, and critical security updates, you will add the (deadsnakes/ppa).

First, install the prerequisite for adding custom PPAs:

sudo apt install software-properties-common -y

Second, add the (deadsnakes/ppa) to your APT package manager sources list:

sudo add-apt-repository ppa:deadsnakes/ppa -y

Now that you have added the repository, refresh your APT sources list.

sudo apt update

Once the repository has been installed, you can now install Python 3.10 by executing the following code:

sudo apt install python3.10

You will see the following packages installed in your installation:

To verify the installation and Python 3.10 build version, perform the following:

python3.10 --version

Example output:

python default ppa version linux mint 20 3.10

Note, this version will change in time is an example only.

Optionally, you can install the following extras.

Install development headers for building C extensions:

sudo apt install python3.10-dev

Install the standard library (venv) module:

sudo apt install python3.10-venv

Install the standard library (distutils) module:

sudo apt install python3.10-distutils

Install the (2to3.10) utility as well as the standard library (lib2to3) module:

sudo apt install python3.10-lib2to3

Install the standard library (dbm.gnu) module:

sudo apt install python3.10-gdbm

Install the standard library (tkinter) module:

sudo apt install python3.10-tk

Alternative – Nightly Builds

For developers that require the latest nightly builds, the PPA has an additional branch for these builds. However, they should only be used by professionals and developers that require the use of such builds.

sudo add-apt-repository ppa:deadsnakes/nightly -y

Now, if you have the default 3.10 stable by (deadsnakes/ppa), you can run the apt update command to upgrade the existing packages.

sudo apt update

Then upgrade the packages:

sudo apt upgrade

If you do not have python installed, use the installation command.

sudo apt install python3.10 -y


If you want to roll back to the stable PPA. First, remove python 3.10.

sudo apt autoremove python3.10 --purge

Next, remove the Nightly build PPA.

sudo add-apt-repository --remove ppa:deadsnakes/nightly -y

Once done, update the APT repository list to reflect the removal.

sudo apt update

Now re-install Python 3.10; you may need to re-add the stable PPA if you remove it. You can toggle between versions doing this. However, it would be advised to set up virtual environments if you need to use multiple environments.

See also
How to Install VSCodium on Linux Mint 21 or 20

Install Python 3.10 – Compile Source Method

The alternative option for those that feel up to more of a challenge or require specific advanced builds from the git repository of the source can opt to install directly from the source. The main issue with this method is that you cannot quickly update like the APT package manager and will need to recompile for any changes.

First, you will need to install the dependencies necessary to build Python 3.10:

sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev -y

The second part is visiting the downloads page on Python’s website and getting the latest version using (wget):


This is Python 3.10 stable version; visit and check for updates.

The file archive is small, so it won’t take long to download. Once done, extract the archive:

tar -xf Python-3.10.0.tar.xz

You will need to switch to the source directory and run the configuration script, which does an essential run-through checklist to ensure all dependencies are present for the installation to work.

cd Python-3.10.0 && ./configure --enable-optimizations

Note, the (–enabled-optimizations) is recommended as it optimizes the Python binary by running multiple tests but takes extra time to compete.

Overall the process should take a few minutes, so it’s recommended not to skip.

The next option is to use the (make) command to start the build process.

make -j 2

Note, the (-j) corresponds to the number of cores in your system to speed up the build time. If you have a powerful server, you can set this as high as possible. If you don’t, it will be the default option of 1. To find out how many cores you have on your system, execute the following code:


Example output:


As you can see, we have two cores, so in the (make) command, we used (-j 2).

In the last step, once you have finished with the build process, you will install Python 3.10 source by executing the following:

sudo make altinstall

Note, the guide has used (altinstall) instead of the default (install) because it will overwrite the default python3 binary python binary file /usr/bin/python.

Check the version of the installation to make sure it has been installed successfully and its current build number:

sudo python3.10 --version

Example output:

Python 3.10.0

Create a Test Virtual Environment

Python’s venv module is a virtual environment is a Python environment such that the Python interpreter, libraries, and scripts installed into it are isolated from those established in other virtual environments, and (by default) any libraries installed on your operating system, for example, those that are installed on your Linux Mint operating system to avoid clashing and disturbing your production environments.

To make sure Python 3.10 is installed correctly and functioning, create a quick Python project.

First, create the project directory and navigate to it:

mkdir ~/test_app && cd ~/test_app

Now inside the project root directory, run the following command to create a virtual environment, for the test name it test_app:

python3.10 -m venv test_app_venv

Note, the compiled installation included venv. However, if you install the APT package manager method, you may need to install the venv package if you encounter problems.

sudo apt install python3.10-dev python3.10-venv -y

Next, activate the virtual environment as follows:

source test_app_venv/bin/activate

After starting the virtual environment, you will now be in the shell prompt terminal. You will notice the name of your environment will be prefixed.


active environment test app python 3.10 linux mint 20

By default, PIP3.10 should be installed, the most used package manager for Python.

Before you begin, check if any upgrades are available for PIP.

python3.10 -m pip install --upgrade pip

Example output:

In the tutorial to test the installation, Apache-Airflow was installed.

See also
How to Install Kate on Fedora Linux


pip3.10 install apache-airflow

Remove the test application using PIP3.10.

pip3.10 uninstall apache-airflow

Example output:

To exit the virtual environment, use the following command:


Comments and Conclusion

In the tutorial, you have learned how to install Python 3.10 on Linux Mint 20using various methods with the PPA by Snakeyes or to compile from source and learn how to create a quick virtual environment.

Overall, Python 3.10 is still better, so sticking with Python 3.9 may be more desirable for the time being. For those wanting to test the latest Python, 3.10 is worth the investment to install.

4 thoughts on “Install/Upgrade Python 3.10 on Linux Mint 20 LTS”

    • Hi James, thanks for the message.

      I believe you would like to type in your terminal python3.10

      Example output from my terminal.

      joshua@main-pc:~$ python3.10
      Python 3.10.0 (default, Oct 11 2021, 05:33:59) [GCC 11.2.0] on linux
      Type “help”, “copyright”, “credits” or “license” for more information.

      and exit() to exit the python 3.10 shell.

      Unless I have misunderstood you.


    • Hi Michael, thanks for the message.

      This seems like an issue between your end and the server, it may be a routing issue or even the repository end.

      I personally just quickly tested it again on a fresh Linux Mint install, works fine on my end, both the standard repository and the nightly PPA.

      Executing: /tmp/apt-key-gpghome.80KJr8B96p/ –keyserver hkps:// –recv-keys F23C5A6CF475977595C89F51BA6932366A755776
      gpg: key BA6932366A755776: public key “Launchpad PPA for deadsnakes” imported
      gpg: Total number processed: 1
      gpg: imported: 1

      Are you behind a proxy or anything at all? That could be a issue.


Leave a Comment

Share to...