Tech
Mar 20, 2024

How to Install Python on Linux Operating Systems

A quick how to guide on how to install Python on Linux OS

‍

‍

Python is a versatile and powerful programming language used for a variety of applications, including web development, data analysis, artificial intelligence, and more. Installing Python on a Linux operating system is a straightforward process that can be completed using package managers or by downloading and installing the Python binaries directly from the official Python website.

‍

Installing Python Using Package Managers

‍

Most Linux distributions come with Python pre-installed. However, to install the latest version or manage multiple Python versions, you can use package managers such as 'apt' (for Debian-based systems like Ubuntu) or 'yum' (for Red Hat-based systems like Fedora).

‍

For Debian-based systems:

‍

1. Update the package list:

‍

2. Install Python:

This command will install Python 3, which is the latest major version of Python.

‍

‍

For Red Hat-based systems:

‍

  1. Update the package list:

2. Install Python:

‍

This command will install Python 3, which is the latest major version of Python.

‍

‍

‍

Installing Python from the Official Website

If you prefer to install Python from the official website or need a specific version not available in your distribution's package manager, you can download the Python binaries and install them manually.

‍

1. Download the Python installation package from the official Python website (https://www.python.org/downloads/). Choose the version that suits your needs.

‍

2. Extract the downloaded package. Open a terminal and navigate to the directory where the package was downloaded. Use the following command to extract the package ( replace 'x.y.z' with the actual version number):

‍

‍

3. Navigate into the extracted directory:

‍

4. Configure the installation. Run the following command to configure the installation, enabling certain features if needed( replace ;x.y.z' with the actual version number):

‍

‍

5. Compile and install Python. Run the following commands to compile and install Python( replace 'x.y.z' with the actual version number):

‍

Verifying the Installation

To verify that Python has been installed correctly, open a terminal and type:

‍

You should see the installed Python version number displayed. You can also start a Python interactive shell by typing

'python3' in the terminal.

‍

Congratulations! You have successfully installed Python on your Linux operating system. You can now start developing applications using Python.

‍