How To Install Python on Linux Using Terminal Interface

In this article, I am going to explain how to install Python on Linux using the terminal interface. But, before we proceed first let’s see what is Python and what is the use of Python. Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built-in data structures, combined with dynamic typing and dynamic binding, makes it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python is simple and easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse.

The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms and can be freely distributed.

To install Python on Linux

  • Check to see if Python is already installed on your system:
    $ python --version

If Python is not installed, install Python with your distribution’s package manager. The command and package name vary:

  • On Debian derivatives such as Ubuntu, use APT:
    $ sudo apt-get install python3
  • On Red Hat and derivatives, use yum:
    $ sudo yum install python
  • On SUSE and derivatives, use zypper:
    $ sudo zypper install python3

Also Read – How To Install PIP (Python Packages Management System) in Linux

Install Python on Linux (Ubuntu)

Before we proceed first let’s update old repositories to their current version.

Open the Terminal and execute the command “sudo apt-get update

mangesh@itsmarttricks:~$ sudo apt-get update *// Starting repositories update //*
[sudo] password for umesh: 
Get:1 xenial-security InRelease [117 kB]     
Hit:2 xenial InRelease                     
Get:3 xenial-updates InRelease [108 kB]    
Get:4 xenial-backports InRelease [116 kB]  
Fetched 341 kB in 4s (152 kB/s)    
Reading package lists... Done *// Updating repositories finished //*

Also Read- Top Basic Linux Commands for Beginners

To Install Python On Linux Download The Package

If you have not to download Python yet then download the latest version of the Python package, Click here to download the Package.

Once the download gets complete follow the steps to proceed further. You can verify this using terminal or graphical way.

mangesh@itsmarttricks:~$ cd Downloads/
mangesh@itsmarttricks:~/Downloads$ ls
Python-3.6.5.tar.xz   *// Downloaded Python 3.6.5 package name //*

Installing Python package

To proceed with installation first we have to extract the downloaded package by executing the following command on the terminal window.

mangesh@itsmarttricks:~/Downloads$ tar -xvf Python-3.6.5.tar.xz   *// Extracting the downloaded package //*
mangesh@itsmarttricks:~/Downloads$ ls
Python-3.6.5 Python-3.6.5.tar.xz *// File successfully extracted //*

As you can see in the above package is extracted successfully. Let’s move on to script configuration

Also Read- How to Generate SSH Keys on Windows 10 with Ubuntu.

Configuring Python Script

Open the Python-directory (extracted file) and use “configure” command to configure it.

mangesh@itsmarttricks:~/Downloads$ cd Python-3.6.5/
mangesh@itsmarttricks:~/Downloads/Python-3.6.5$ ls
aclocal.m4    Doc         LICENSE          Objects
config.guess  Grammar     Mac              Parser    Python
config.sub    Include  PC        README
configure     install-sh  Misc             PCbuild  Lib         Modules          Programs  Tools
mangesh@itsmarttricks:~/Downloads/Python-3.6.5$ ./configure

Now you have successfully completed the script configuration.

Completing Python Installation

To complete the installation process we will use the following commands:

  • sudo make
  • sudo make install
mangesh@itsmarttricks:~/Downloads/Python-3.6.5$ sudo make
mangesh@itsmarttricks:~/Downloads/Python-3.6.5$ sudo make install *// Final command //*

We have successfully installed the Python 3.6.5 package on Ubuntu 17.10. Open a command prompt or shell and run the following command to verify that Python installed correctly:

$ python3 --version Python 3.6.5

Also Read- How to Install Ubuntu on Windows 10.

That’s all, In this article, we have explained How To Install Python on Linux Using Terminal Interface. I hope you enjoy this article. If you like this article, then just share it and then do subscribe to email alerts for Linux, Windows, macOS, Android, Internet, Firewall and Security, CCTV tutorials. If you have any questions or doubts about this article, please comment.

Share this:
WhatsApp Channel Join Now
Telegram Channel Join Now
Instagram Channel Join Now

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.