3 Methods for How to Install Python on Linux System

Nowadays, most Linux Distros already have Python preinstalled. But you might have a distribution that might not have Python preinstalled. As some OSs allow users to download and install whatever the user feels important and necessary. If you are also using one of such light Linux distros, here is how to install Python on your Linux PC.

There is also a chance that Python is already installed on your Linux system. But you are not able to find it due to some reason. In such cases also continue reading this article till last and you would surely be able to locate and use Python on your Linux PC.

Some Linux system even though comes preinstalled with Python but don’t include the Interactive Development Environment (IDLE) application. This could happen mainly if you have an older version of Python (2.5.1 or earlier) installed on your system. In such cases, you might want to update Python to a newer version so that you could have an access to IDLE.

How to Install Python using terminal

Installing Python is easier on Ubuntu, as it’s already present in the official Ubuntu repositories. All you need to do is just execute the commands below one by one in the terminal.

sudo apt-get update
sudo apt-get install python3

This will install Python on your system, to check if it’s properly installed just execute the command below. If you don’t know if Python is preinstalled on your PC, execute the command below and it will tell you the installed version of Python on your system.

python -V

Below are the other methods to Install Python on your system.

Installing Python using Software Center

This might not work on every Linux distro, as not every Linux distro comes with its own Software store. But most popular Linux distros nowadays have a software center. And you can easily install Python from the software center(if it’s in the software center).

Just open Software Center or App Center on your Linux system. Search for Python and then click on Install. This will begin the installation of Python on your system and soon you will have it installed.

Install Python on Linux using the Source Code

Step 1: Downloading latest Python version

To install Python, navigate to the official Python site and you will see the latest Python release with two download options.

  • Python X.x.x – Download Gzipped source tarball (Regular version for any Linux version)
  • Python X.x.x – Download XZ compressed source tarball (More compressed for faster download)

Click on the download link for any of the above versions for the latest stable release. Then you should be able to see a download dialog box with options to Open and Save. Click on Save to download the archive file.

Step 2: Installing Python

Navigate to download folder, this is where downloaded Python file is saved. Then double click on the downloaded file to decompress the file. Then when the archive manager completes extraction of compressed Python file, open the extracted Python folder.

In the folder right-click anywhere and click on Open in Terminal. Then in the terminal execute the below commands one by one. If you already have anything preinstalled you can just skip that particular command.

sudo apt-get install build-essential
sudo apt-get install libsqlite3-dev
sudo apt-get install libbz2-dev

These commands install build-essential, Libsqlite3 and Libbz2 on your system.

Now in terminal type cd python X.x.x with X.x.x being your downloaded Python version. Then type ./configure and press Enter. This process will take a minute or two to complete. Then after its done just execute the below commands one by one to complete the installation.

./configure
make
make test
sudo make install

After this completes you should have Python installed on your system. If while using python you find an error pip command not found here is how to fix it. To check if Python is properly installed execute the command below.

python -V

Output of this command gives the version of python installed on your system.

Conclusion:

In this article, we saw how we can install Python on our Linux system or PC. Python is one of the most popular as well as awesome programming languages. I hope this helps you. Thanks for reading till last.

Leave a Reply

Share via
Copy link