Your path to becoming an Ethical Hacker! Hacking Academy Try It Now!

How to install Python on Linux?

Before we begin explaining how to install Python3 on Linux, let's first understand the basics of Python. Python is a popular programming language that is used for many different types of tasks. It allows you to work quickly and integrate systems more efficiently. There are two main versions of Python: Python 2 and Python 3. These two versions are quite different from each other.

Getting Started with Python

Python is easier to code and learn compared to many other programming languages. You can write Python programs using any plain text editor, such as Notepad or Notepad++. Alternatively, you can use an online Integrated Development Environment (IDE) or install one on your system. IDEs offer features like a code editor, debugger, and compiler, making it easier to write and manage Python code. To start writing Python code and performing various operations, you need to have Python installed on your system.



Check if Python already exists

Most Linux operating systems come with Python pre-installed. To check if Python is installed on your device, open the terminal using Ctrl+Alt+T and run the following command:

For Python 2:

python --version


For Python 3.x:

python3.x --version

If Python is installed, it will display a message showing the Python version that is available.


Beginning Python installation

To install Python on most Linux systems, you can use the following command:

sudo apt-get install python3.8

To begin the installation, you will be prompted to enter your password. This step is necessary to grant permission for the installation process to continue. Once you enter your password, you can proceed with the installation of Python.


When installing Python, you might be asked if you want to allocate additional disk space. To proceed, you typically type "Y" for yes and then press Enter. This allows the installation process to use the necessary disk space for Python.


During the installation process, Python will fetch and install the required packages and modules automatically. This process occurs automatically after you give permission to assign the disk space.


Getting through the installation process


The installation process for Python is now complete.


To verify that Python 3.8 is installed correctly, you can enter the following command in your terminal:

python3.8 --version

This command will display the version of Python 3.8 that is installed on your system. If Python 3.8 is installed correctly, you should see the version number displayed in the terminal.

To run your first Python program, which is a simple "Hello World" program, follow these steps:

1. Open a text editor and paste the following code:

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

2. Save the file with a `.py` extension, such as `hello.py`.

3. Open a terminal and navigate to the directory where you saved the `hello.py` file.

4. Run the program by entering the following command:

python3 hello.py

5. You should see the output `Hello World` printed in the terminal, indicating that your Python program has run successfully.

تعليقان (2)

  1. sorry
    1. What's the problem bro
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.