Python is a cross-platform programming language that can run on multiple platforms like Windows, macOS, Linux, and can be ported to the Java and .NET virtual machines.

To install the python on the local machine, get the copy of the Python standard distribution software from the Python Software Foundation website at based on your operating system, hardware (32-bit or 64-bit) and operating system version of your local machine.

As of writing the tutorial, the Python current version is 3.8.3. However, always check the latest version and install it.

Installation Procedure –

Ubuntu comes with Python 2.7.5 preinstalled and that is pretty much outdated. We need to update the Python to the latest version and below are the step by step procedure to install it –

Prerequisites –

  • Ubuntu
  • User should login as an Administrator

Step1 - Install required packages for Python

Use the following command to install Python prerequisites.

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

Step2 - Download Python 3.8.3

Download the Python from the official site using the below command.

# cd <target-download-library>

# wget

Note! The link showing 3.8.3 which is the Python current version. For example, if the tomorrow version is 3.8.6, the link is If the version is different for future installations, replace 3.8.3 with the future version to create the future link.

Next, extract the downloaded package.

# tar xzf Python-3.8.3.tgz

Step3 – Compile Python Source

Use below set of commands one by one to compile python source code on your system using altinstall.

# cd Python-3.8.3

# sudo ./configure --enable-optimizations

# sudo make altinstall

Note! "make altinstall" is used to prevent replacing the default python binary file /usr/bin/python.

Now, remove downloaded source archive file from the system.

# sudo rm Python-3.8.3.tgz

Step4 – Verify the Python installation

In Python IDLE terminal, use print command to verify the python successfully installed or not. Here, we are using a print command to display the output.

$ print(“Welcome to TutorialsCampus”)

If the output gets displayed immediately and command prompt shows again, that confims the python installed successfully on the Ubuntu. We can start coding of Python language.