HomepythonHow to install Python on Linux?

How to install Python on Linux?

Installing Python on Linux varies slightly depending on the Linux distribution you are using. Here are the general steps for popular distributions:

Ubuntu/Debian-based Systems

  1. Update Package List:
    Open the terminal and update the package list:
sudo apt update
SSH Config
  1. Install Python:
    Install Python by running the following command. This will install the latest version available in the repository:
sudo apt install python3
SSH Config
  1. Verify Installation:
    Check the installation by running:
python3 --version
SSH Config
  1. Install pip:
    Pip is the Python package installer. Install it with:
sudo apt install python3-pip
SSH Config
  1. Verify pip Installation:
    Check pip installation by running:
pip3 --version
SSH Config

Fedora/RHEL/CentOS-based Systems

  1. Update Package List:
    Open the terminal and update the package list:
sudo dnf update
SSH Config
  1. Install Python:
    Install Python by running the following command. This will install the latest version available in the repository:
sudo dnf install python3
SSH Config
  1. Verify Installation:
    Check the installation by running:
python3 --version
SSH Config
  1. Install pip:
    Pip is the Python package installer. Install it with:
sudo dnf install python3-pip
SSH Config
  1. Verify pip Installation:
    Check pip installation by running:
pip3 --version
SSH Config

Arch Linux

  1. Update Package List:
    Open the terminal and update the package list:
sudo pacman -Syu
SSH Config
  1. Install Python:
    Install Python by running the following command:
sudo pacman -S python
SSH Config
  1. Verify Installation:
    Check the installation by running:
python --version
SSH Config
  1. Install pip:
    Pip is the Python package installer. Install it with:
sudo pacman -S python-pip
SSH Config
  1. Verify pip Installation:
    Check pip installation by running:
pip --version
SSH Config

Additional Configuration (Optional)

  • Set Up Virtual Environments:
  • It’s a good practice to use virtual environments for your Python projects to manage dependencies. You can create a virtual environment by running python3 -m venv myenv in the terminal, where myenv is the name of the virtual environment.
  • Install an IDE/Text Editor:
  • You can install an Integrated Development Environment (IDE) or a text editor for writing Python code. Popular options include PyCharm, Visual Studio Code, and Sublime Text.

Following these steps will set up Python on your Linux system, allowing you to start developing Python applications.

Subscribe
Notify of

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Popular