Friday, November 15, 2024
Google search engine
HomeLanguagesHow to install Python on Linux?

How to install Python on Linux?

Prerequisite: Python Language Introduction
 
Before we start with how to install Python3 on Linux, let’s first go through the basic introduction to Python. Python is a widely-used general-purpose, high-level programming language. Python is a programming language that lets you work quickly and integrate systems more efficiently. There are two major Python versions- Python 2 and Python 3. Both are quite different.

Getting started with Python

Python is a lot easier to code and learn. Python programs can be written on any plain text editor like notepad, notepad++, or anything of that sort. One can also use an online IDE for writing Python codes or can even install one on their system to make it more feasible to write these codes because IDEs provide a lot of features like intuitive code editor, debugger, compiler, etc.
To begin with, writing Python Codes and performing various intriguing and useful operations, one must have Python installed on their System. This can be done by following the step by step instructions provided below:

What if Python already exists? Let’s check

Most of the Linux OS has Python pre-installed. To check if your device is pre-installed with Python or not, just go to terminal using Ctrl+Alt+T

Now run the following command:
For Python2

python --version

For Python3.x

python3.x --version

If Python is already installed, it will generate a message with the Python version available.

Check-python-version-for-linux

Download and Install Python:

Before starting with the installation process, you need to download it. For that all versions of Python for Linux are available on python.org.
All-versions-of-Python

Download the required version and follow the further instructions for the installation process.

Beginning the installation.

For almost every Linux system, the following command could be used to install Python directly:

$ sudo apt-get install python3.8
  • Getting Started:
    Getting-Started
  • Assigning DiskSpace:
    Assigning-DiskSpace
  • Fetching and Installing Packages:
    Fetching-and-Installing-Packages
  • Getting through the installation process:
    Getting-through-the-installation-process
  • Finished Installation:
    Finished-Installation

To verify the installation enter the following commands in your Terminal.

python3.8

To-check-if-installed-correctly

Let’s consider a simple Hello World Program.




# Python program to print
# Hello World
  
print("Hello World")


Output:
Hello-World-Python-Linux
RELATED ARTICLES

Most Popular

Recent Comments