How to install Python on Linux Mint 20

If we discuss very popular programming languages, we have to discuss Python. This programming language is present in many technologies that are part of our days. And Python is also a fundamental component of many Linux distributions. So, in this post, you will learn how to install Python on Linux Mint.

The installation of Python in Linux Mint

Many of the applications or configuration scripts that come by default in Linux Mint and in any Linux distribution are made in Python. That is why in Linux, Python is a major component of each of the distributions.

However, it is always possible to upgrade Python or install alternative versions so that developers have more tools to create their applications. For example, Python 3.10 has recently been released with a lot of new features that many developers would like to take advantage of.

So let’s go for it.

Install Python on Linux Mint

Python is installed by default on Linux Mint and other distributions. To check it, you can open a terminal from the main menu and run.

python3 --version

Sample Output

Python 3.8.10

As we can see, the installed version is 3.8.10 which we can consider as stable, but it is not the most recent one.

You can also check if PIP, the Python package manager, is installed by using the command

pip3 -V

Sample Output:

pip 21.3.1 from /home/user/.local/lib/python3.8/site-packages/pip (python 3.8)

If you don’t have it installed, then you can do it using the command

sudo apt install python3-pip

Now that we know we have Python on the system, we can install a newer version.

Install Python 3.10 on Linux Mint 20

For many developers, having the latest version of the programming language where they make their applications is vital. So today, we will see how to get the latest stable version, which is 3.10.

One method to do this is through the Python PPA repository. Before adding it, it is necessary to install a package. So, in a terminal run

sudo apt install software-properties-common

Now add the repository in question:

sudo add-apt-repository ppa:deadsnakes/ppa

Refresh APT to apply the changes

sudo apt update

And now, install Python 3.10 using this command

sudo apt install python3.10

Then, you can check the installed version.

python3.10 --version

Output

Python 3.10.2

And just like that, we can install it without interfering with the version of Python on the system.

Another method: Installing Python from source code

Some people prefer to compile the source code themselves to have more control over their applications.

Regarding Python, we can do this too.

Note: you don’t have to use both methods. Just choose one.

First, download the Python 3.10 source code in its latest stable version.

wget https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tgz 

Now unzip it using tar.

tar xzf Python-3.10.2.tgz 

Access the folder and configure it.

cd Python-3.10.2
sudo ./configure --enable-optimizations

And now compile it and install it alternatively to the system.

sudo make altinstall 

At the end, you can check again the installed version to know if the installation was successful.

python3.10 --version

You should get this screen output

Python 3.10.2

That’s how we failed to get Python on Linux Mint 20.

Conclusion

Python is an important programming language today. It is shaping up to be the most popular, or at least in the top. Thanks to this post you can install it on Linux Mint 20 and besides that upgrade it to recent versions.

Thanks for reading our post and help us to grow by sharing it with your friends. Do you want to leave us a comment?

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top