Special offer
+370 5 205 5502 sales@monovm.com

How to Install Python on Ubuntu

Python is one of the most well-known programming languages out there. Today we will be showing you how to install Python on Ubuntu.

29 Jun, 21 by Antoniy Yushkevych 6 min Read

List of content you will read in this article:

Python is an open-source programming language that helps you run programs and extensions from various third-party providers on your system (or even applications you develop). It means that you can operate it on many different operating systems, including the Windows VPS Server. Python is cross-platform.

Python isn't pre-installed on Windows, although it doesn't rule out the possibility that Windows users will find the lightweight programming language helpful. It's not as simple as just upgrading to the most recent version, so be sure you've got tools for the task.

Python is a famous high-level programming language for the use of general-purpose programming computing that debuted in 1991. It has always been favorite of hobbyists and qualified developers alike, owing to a design concept that stresses readability. Not only is it a surprisingly easy language to understand, but there are several projects available online that require Python to be enabled to use the program.

What Version Would Users Require?

Regrettably, a major upgrade to Python many years ago resulted in a large break among Python releases. It may be a little perplexing for beginners, but don't worry. We'll demonstrate how to set up all of the major ones.

When you go to the Python for Windows downloads tab, you'll notice the separation right away. The registry always asks whether you want the latest Python 2 or Python 3 upgrade at the core, square, and center. It is recommended to install and run all versions simultaneously to get the most out of Python.


Visit the official website and navigate to the “Downloads” section to get Python. The most recent Python version for Ubuntu can be found on the website. Go ahead and download it. 

Untar the file after downloading the tarball. You will see a couple of directories after untarring the file. The readme file is the one you'll want to look at because it contains instructions for installing Python on an Ubuntu system.

Adjust the directory of the untarred Python file and execute the command below in the terminal.

 cd ~/<python untarred folder>

Install python command:

  • ./configure
  • make
  • make test
  • sudo make install

It will make the installation of python as python3.

If you get an error message or warning when running sudo ./configure, like no compiler found,  install the below library to get rid of it:

apt-get install build-essential

Also, if you get an error message or warning when running, like make not found, j run the below command to install make:

sudo apt install make

After you've installed the above libraries, such as create and build-essential, you should be able to use the install python command.

Another way to install Python is to use the apt-get commands as seen below:

In the terminal, type the following commands:

sudo apt-get update

It will ensure that Ubuntu's repositories are up to date. Run the following order to install Python:

sudo apt-get install python3

Setting path

You may use the following command to locate the current device route on your machine:

echo  $PAT

Then, if you want to send your Python executable a different path, users could simply use the export directive and give it a directory path like this:

export PATH=$PATH:`<path to executable file>’

It will not be continued across various terminals if you only execute the above export instruction. The shift will miss if the terminal is closed and reopened. To make it persistent, apply the above command to the ~/.bashrc file in the ubuntu system's root folder.


Simply run the command to run python code.

python <pythonfile.py>

Installation of Extra Python Packages: Run the command pip3 list to watch what modules are installed in the application. It will show a list of all the modules currently installed in the environment. If you choose to install additional modules in the environment, such as the request library, you can do so with pip3 install requests. Now run the pip3 list to see if this request lib is installed in this setting.

Directory as a package for distribution:

Within the Python project or directory, a file named init .py is used as a delivery kit. As a result, you can make this file with a single touch button. This file does not need to contain any data; it simply needs to be present in the directory to function as a package.

Utilizing Various Python Versions

You’d have two separate versions of Python on your framework if you used the alt install tool. Each installation comes with its own set of instructions.

Execute commands on every older Python 2.x version on your machine with the python button. Consider the following scenario:

python ––version

Using python3 to execute a script in the newer version. Consider the following scenario:

python3 ––version

You can install different major (3.x or 2.x) versions of Python on your device. Using the second digit to specify which version you choose to use if you have both Python 3.7.x and Python 3.8.x installed:

python3.7 ––version

python3.8 ––version


Hence, we have successfully learned how to install Python on Ubuntu and the installation’s various functionalities. We recommend running all versions simultaneously if you want to get the most out of Python. It helps to use the most modern Python version while still operating older Python scripts and testing functionality for newer projects. However, if you're certain you only need one Python version, you may install just Python 2 or Python 3. Also, if you wish to use Python on Windows instead, check out our detailed tutorial on how to install Python on Windows.

Antoniy Yushkevych

Master of word when it comes to technology, internet and privacy. I'm also your usual guy that always aims for the best result and takes a skateboard to work. If you need me, you will find me at the office's Counter-Strike championships on Fridays or at a.yushkevych@monovm.com