How to install Python on Linux?

Submitted by Kamal Wickramanayake on Mon, 11/09/2020 - 01:01

Python can easily be installed by using the package management software of the Linux distribution used.

In case of Ubuntu, "apt" command can be used as follows to install Python 3.8 from a terminal:

sudo apt install python3.8

Now, type "python3.8" in the terminal and the Python interactive shell should appear as follows:

Python interactive shell

If you are interested in testing, type the below line of Python code after the prompt (">>>") and hit enter:

print("Hello World!")

You will see that the text "Hello World!" is echoed.

To exit, type CTRL+d.

Python IDLE, which stands for Integrated Development and Learning Environment is a software development tool for Python. If all what you need is to run Python programs, you need not install it. There are other more advanced software development environments that can be used to develop Python programs. But if you prefer to give it a try, it can also be installed in the same way:

sudo apt install idle-python3.8

Select IDLE from the application menu or run the command "idle-python3.8" from a terminal to run IDLE. A window similar to this will appear:

Python IDLE