pip and venv are available, and understand how to install a newer release if your distribution packages an older one. This guide covers the most popular distributions and their package managers.
Check what is already installed
Open a terminal and run:pip is available:
Linux uses
python3 to distinguish from the legacy Python 2 interpreter, which is still present on some older distributions. Always use python3 explicitly unless you have configured a python alias or symlink yourself.pip is not found, the steps below will get you sorted.
Install or update Python
- Ubuntu / Debian
- Fedora / RHEL / CentOS
- Arch / Manjaro
- openSUSE
- Alpine
1
Update your package lists
2
Install Python, pip, and venv
python3-venv gives you the venv module for creating isolated project environments — you will use this throughout the course.3
Install development headers (optional but recommended)
Some Python packages compile native extensions during installation. The development headers are needed for that:
4
Get the latest Python via the deadsnakes PPA (optional)
If your distribution ships an older Python 3 version and you want the latest release:
Verify your installation
After installation, confirm both Python and pip are accessible:Test the Python interpreter
Launch the Python REPL to confirm everything is working end-to-end:>>> prompt:
exit() or Ctrl + D.
Troubleshooting
'python3' command not found
'python3' command not found
Python is not installed (or not in your PATH). Install it using your package manager:After installation, open a new terminal and try
python3 --version again.'pip3' command not found
'pip3' command not found
pip is not installed. Fix it with your package manager or the Python built-in bootstrap:
Permission denied when installing packages
Permission denied when installing packages
On Linux, you should never install pip packages into the system Python with Inside the virtual environment,
sudo pip3 install — it can conflict with system packages.Preferred solution — use a virtual environment:pip install works without sudo or permission issues.Alternative — install in your user directory:externally-managed-environment error (pip refuses to install)
externally-managed-environment error (pip refuses to install)
Modern Ubuntu (23.04+) and other distributions enforce PEP 668, which prevents pip from installing packages into the system Python environment. This is intentional — it protects system tools.Use a virtual environment (recommended):Install in user directory:Use pipx for standalone tools:
Python version is too old
Python version is too old
If your distribution ships an outdated Python 3 (e.g., 3.8 on older Ubuntu), you have several options:Option 1 — deadsnakes PPA (Ubuntu/Debian):Option 2 — compile from source:Option 3 — pyenv: A dedicated version manager that installs any Python version in your home directory without touching system files. Install it from github.com/pyenv/pyenv.
Use
make altinstall (not make install) to avoid replacing the system python3 symlink.Next steps
Continue to VS Code Introduction
Install and configure Visual Studio Code as your Python editor.