Linux distributions often come with Python pre-installed, as many system tools rely on it. However, the pre-installed version might not be the latest, or you might need a specific version for your projects. Checking your Python installation and then installing or updating Python as needed is important.
First, open your terminal application. This is your command-line interface to the system. You can usually find it by searching for "Terminal" in your applications menu.
Once the terminal is open, you can check if Python 3 (the current standard) is installed and what version you have. Type the following command and press Enter:
python3 --version
If Python 3 is installed, you'll see output similar to this (the exact version number will likely differ):
Python 3.10.4
If you get an error like "command not found," Python 3 is likely not installed or not in your system's PATH (a list of directories where the system looks for executable programs).
You might also try:
python --version
On some older systems, or systems configured differently, python might point to Python 2, which is no longer supported and should not be used for new development. If this command shows a version starting with 2.x.x, you should specifically use the python3 command for your work. If it shows a 3.x.x version, then python and python3 might be aliases for the same installation on your system. For consistency and clarity, especially when starting, it's generally best to use the python3 command explicitly.
The recommended way to install or update Python on Linux is through your distribution's built-in package manager. This ensures that Python integrates correctly with the rest of your system and handles dependencies properly. Here are the commands for some of the most common Linux distributions:
For Debian, Ubuntu, and derivatives (like Linux Mint):
First, update your package list to ensure you get the latest available versions:
sudo apt update
sudo stands for "superuser do" and grants administrative privileges for the command that follows. You'll likely be prompted for your password. apt is the package manager. update refreshes the list of available packages.
Install Python 3, pip (the Python package installer), and venv (for creating virtual environments):
sudo apt install python3 python3-pip python3-venv
This command tells apt to install the specified packages. python3 is the interpreter itself, python3-pip allows you to install additional Python libraries, and python3-venv helps manage project-specific dependencies (which we'll discuss later).
For Fedora:
Update your package list:
sudo dnf check-update
Fedora uses the dnf package manager.
Install Python 3 and pip:
sudo dnf install python3 python3-pip
(The python3-venv functionality is often included with the main python3 package on Fedora).
For Arch Linux and derivatives (like Manjaro):
Synchronize package databases and update the system:
sudo pacman -Syu
Arch uses the pacman package manager. -Syu refreshes the package lists and upgrades installed packages.
Install Python 3 and pip:
sudo pacman -S python python-pip
On Arch, the package names are typically python (for the latest Python 3) and python-pip.
If you are using a different Linux distribution, consult its documentation for the appropriate package manager commands (e.g., zypper for openSUSE, yum for older CentOS/RHEL). The package names are usually similar (python3, python3-pip).
After running the installation commands, verify that Python 3 and pip are correctly installed. Open a new terminal window or type the commands again:
python3 --version
pip3 --version
You should now see the installed version numbers printed to the console without errors. Seeing these versions confirms your Python development environment is ready on your Linux machine.
With Python installed, you're now equipped to start interacting with the Python interpreter or writing your first scripts, which we'll cover in the next sections. Using your distribution's package manager is typically the simplest and most reliable way to manage your main Python installation on Linux.
Was this section helpful?
venv for creating isolated Python virtual environments, a fundamental practice for dependency management.© 2026 ApX Machine LearningEngineered with