Skip to main content
Most modern Linux distributions ship with Python 3 pre-installed, which makes getting started particularly smooth on Linux. Even if your system Python is present, it is good practice to verify the version, ensure 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:
If you see Python 3.10 or later, you are in good shape for this course. Also check that 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.
If Python is missing, outdated, or pip is not found, the steps below will get you sorted.

Install or update Python

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:
The deadsnakes PPA is maintained by the Python community and provides up-to-date Python packages for Ubuntu. It is widely trusted and used.

Verify your installation

After installation, confirm both Python and pip are accessible:
Expected output (version numbers will vary):

Test the Python interpreter

Launch the Python REPL to confirm everything is working end-to-end:
You will see the >>> prompt:
Try a quick command:
Exit with exit() or Ctrl + D.

Troubleshooting

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.
pip is not installed. Fix it with your package manager or the Python built-in bootstrap:
On Linux, you should never install pip packages into the system Python with sudo pip3 install — it can conflict with system packages.Preferred solution — use a virtual environment:
Inside the virtual environment, pip install works without sudo or permission issues.Alternative — install in your user directory:
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:
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:
Use make altinstall (not make install) to avoid replacing the system python3 symlink.
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.

Next steps

Continue to VS Code Introduction

Install and configure Visual Studio Code as your Python editor.