Learn How To Install Python 3.9 in Ubuntu 20 | Linux Mint 20

Learn How To Install Python 3.9 in Ubuntu 20 | Linux Mint 20

Python is an object-oriented, high-level programming language, highly preferred by both newbies and professionals in the programming community.

Python 3.9 is the latest major release of the Python language at the time this article was written. Its improved features include new improved modules, new str functions, support for proper time zones, and much more.

This tutorial will help you to install Python 3.9 on Ubuntu 20 | Linux Mint 20, using dead snakes PPA to install Python.

Benefits of python

Easy to Read, Learn and Write
Free and Open-Source
Vast Libraries Support
Able to be run on any platform, once written


We start the installation process by updating our package list and installing the prerequisites:

sudo apt update
sudo apt install software-properties-common

Once done we update our repository list with deadsnakes PPA on our system’s sources list:

sudo add-apt-repository ppa:deadsnakes/ppa

When prompted, press [Enter] to continue

Once the repository is enabled, we proceed with Python 3.9 installation by executing.

techies@techiescode:~$ sudo apt install python3.9
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
python3.9-venv python3.9-doc binutils
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 477 kB of archives.
After this operation, 565 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 python3.9 amd64 3.9.7-1+focal1 [477 kB]
Fetched 477 kB in 1s (395 kB/s)     
Selecting previously unselected package python3.9.
(Reading database ... 189781 files and directories currently installed.)
Preparing to unpack .../python3.9_3.9.7-1+focal1_amd64.deb ...
Unpacking python3.9 (3.9.7-1+focal1) ...
Setting up python3.9 (3.9.7-1+focal1) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...

To verify that the installation was successful, we run:

$ python3 -V

Python 3.9.5

Python 3.9 is installed on your Ubuntu system and ready to use.

In this article, we will go a step ahead and show an example of python3 usage from the terminal.

To run our python setup from the terminal, we execute the command:

techies@techiescode:~$ python3

Python 3.9.7 (default, Sep 24 2021, 09:43:00) 
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print("Hello World!!")
Hello World!!
>>> exit()

We can also write a python file and execute it using python3.

Selecting your best text editor, create a helloworld.py file. And paste the “print (“Hello World!!”)” command that we will be executing.

In my case, I will be using vim editor.

$ vim helloworld.py

Paste the below code, save and exit from the text editor.

print("Hello World!!")

To run the python file we have created, execute it as below. To get our output.

techies@techiescode:~$ python3 helloworld.py 
Hello World!!


In this tutorial, you have learned to install Python 3.9 on Ubuntu 20 | Linux Mint 20 using Apt and confirmed its workability by writing and executing our helloworld.py file.

Leave a Reply

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

three × 1 =