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
- Update Package List:
Open the terminal and update the package list:
sudo apt update
SSH Config- 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- Verify Installation:
Check the installation by running:
python3 --version
SSH Config- Install pip:
Pip is the Python package installer. Install it with:
sudo apt install python3-pip
SSH Config- Verify pip Installation:
Check pip installation by running:
pip3 --version
SSH ConfigFedora/RHEL/CentOS-based Systems
- Update Package List:
Open the terminal and update the package list:
sudo dnf update
SSH Config- 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- Verify Installation:
Check the installation by running:
python3 --version
SSH Config- Install pip:
Pip is the Python package installer. Install it with:
sudo dnf install python3-pip
SSH Config- Verify pip Installation:
Check pip installation by running:
pip3 --version
SSH ConfigArch Linux
- Update Package List:
Open the terminal and update the package list:
sudo pacman -Syu
SSH Config- Install Python:
Install Python by running the following command:
sudo pacman -S python
SSH Config- Verify Installation:
Check the installation by running:
python --version
SSH Config- Install pip:
Pip is the Python package installer. Install it with:
sudo pacman -S python-pip
SSH Config- Verify pip Installation:
Check pip installation by running:
pip --version
SSH ConfigAdditional 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, wheremyenv
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.