How to install Python on Linux – Step by Step Guide

Python is a  general-purpose, widely used high-level programming language. Nowadays, it became very popular for web development, AI, ML, and video game development. In this section, we will discuss how to install python in a Linux system.

Step-by-Step Installation instructions: Python on Linux

Step1: Open the terminal emulator by pressing Ctrl+Alt+T.

Step2: Install the latest version of Python3 by using your Linux distro compatible package manager, also make sure to run the command with the sudo permission.

  • apt-get package manager:
sudo apt-get install python3

apt-get package manager

  • pacman package manager:
sudo pacman -S python3

How to install Python on Linux

  • dnf package manager:
sudo dnf install python3

PYTHON ON LINUX

Step3: You would get a message “Do you want to continue?” during the installation process, press ‘y‘ in order to continue the process.

Step4: After the installing process is finished, verify the installation.

Check Python version in Linux

python3 --version

Check Python version on Linux

To ensure that the python is successfully installed in our system, let’s test it with a small program.

Python program to print Hello World:

print("Hello World")

Save the program with filename.py and compile it using python3 in the terminal.

CodeSpeedy@hp-1500:~/Desktop/files$ python3 filename.py

Output:

Hello World

Run first Python program on Linux

Our python program is compiled and running successfully.

Hope you have enjoyed this and learned how to install python on different Linux systems.

Happy Coding!!!

You can also read, How to install C++ on Linux – Step-by-Step Guide

Leave a Reply

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