1. Overview

In this tutorial, we will see how to install the latest Python on Linux Mint and Ubuntu. We will cover two ways to install Python on Ubuntu like systems:

  • via APT
  • from source

Python 3.10 is the latest version as of writing this post.

2. Installing Latest Python 3 on Linux Mint with Apt

Let's start by the simplest way to install the latest Python 3 on Linux Mint - with PPA.

There is a PPA - “deadsnakes” team where the latest version of Python can be found.

To install any Python version from it follow next steps:

  • Start your terminal
  • Update the package list by:
sudo apt-get update
  • Add the deadsnakes PPA to the sources list:
sudo add-apt-repository ppa:deadsnakes/ppa
  • install latest Python by:
sudo apt-get install python3.10
  • install additional setup tools by(to use Python as virtual environment and install packages):
sudo apt install python3.10-distutils
  • verify the installation by:
python3.8 -V

result:

Python 3.8.4

Finally you can start it by typing:

python3.8

or add it to your IDE like PyCharm: How to install Python 3.7 and setup PyCharm on Linux Mint 18/19

3. Install Latest Python on Linux Mint from Source

To install latest Python on Linux Mint or Ubuntu from the sources you need to follow the next steps:

  • install dependencies by:
sudo apt-get update
sudo apt-get install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev
cd ~/Downloads
sudo wget https://www.python.org/ftp/python/3.10.1/Python-3.10.1.tgz
  • extract the archive
sudo tar -xf Python-3.10.1.tgz
  • open the extracted folder:
cd Python-3.10.1
  • build the package and prepare the source for the installation
./configure --enable-optimizations
  • install the Python on your system:
sudo make altinstall

Note: In order to prevent collision with the pre-installed Python on Ubuntu / Linux Mint we use altinstall instead of install

  • test the latest Python version by:
python3.10 -V

result:

Python 3.10.1

4. Conclusion

In this tutorial, we have learned to install the latest Python on Linux Mint in two ways. As a bonus we learned how to configure Python on Pycharm.