How ToLinux

How to Install Python on Linux [Simple Steps]

You can easily install Python on Linux with simple command lines.

Linux is the best OS for doing coding-related things. But installing apps on Linux is not a layman job. That’s why Linux OS is only preferred by web developers and coders. On the other hand, Python is the go-to tool for all the developers, it can be installed easily on any OS like Windows, Mac, Linux, and other OS.

Most of the Linux distribution comes with Python installed on it. But the version may be an outdated version or older version. You need to install the new version of Python for your Linux OS.

To check the Python’s version on your Linux, type the following code on a terminal window

python --version

The above code will return the following result

$ python --version
Python 2.4.6

The x.x.x (2.4.6) represents the Python’s version. As of now (Feb 2020), the latest version of Python available on their website is 3.8.1.

Steps to install Python on Linux

python on linux

To install Python on Linux OS, type the following commands.

# wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tar.xz
# tar xJf Python-3.6.3.tar.xz
# cd Python-3.6.3
# ./configure
# make
# make install

The installation process will take a while to complete. To check the installation is complete, type the following command.

# which python3
# python3 -V

The output of the command will be similar to the result below.

root@mail: -# which python3
/usr/local/bin/python3
root@mail: -# python3 -V
Python 3.6.8
root@mail: -# python3
Python 3.8.3 (default, Feb 8 2020, 10:50:45)
[GCC 6.3.0 20201516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

To exit the Python window, type

quit ()

Now, you have installed Python. If you want, you can also install Python IDLE. Python IDLE is a GUI (Graphic User Interface) tool. Type

# apt-get install idle (for Debian)
# yum install python-tools (for CentOS)

When you execute the above code, Python IDLE will be installed.

Techowns Tip: How to Kill a Process on Linux?

In this way, you can install Python on your Linux. The installation process on Linux is different than Windows OS. You can’t get the extension file from the website and run them on your Linux OS as you do in Windows. You need to get things right only on codes.

If you have any queries or feedback, leave it in the comment section below. Follow our Twitter and Facebook page and stay connected with us for more updates.

Was this article helpful?
YesNo

Related Articles

Leave a Reply

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

Back to top button