How to Install Python on Ubuntu Linux (2026 Guide)

Most Ubuntu Linux systems already include Python 3, so installing Python on Ubuntu often just means adding pip and venv. Open a terminal and run:

sudo apt update
sudo apt install python3 python3-pip python3-venv
python3 --version

Which version you get depends on your Ubuntu release. I checked packages.ubuntu.com in October 2026, and the screenshots are real captures of that page and the deadsnakes PPA.

This guide covers the built-in Python, newer versions from the deadsnakes PPA, uv, setting up pip with virtual environments, and fixing the errors new Linux users usually run into.

Which Python version comes with Ubuntu?

Each Ubuntu release ships one default python3 and sticks with it for that release’s life. Ubuntu’s own tools depend on it, so you shouldn’t remove or replace it:

Ubuntu releaseCodenameDefault python3
22.04 LTSJammy Jellyfish3.10
24.04 LTSNoble Numbat3.12
25.10Questing Quokka3.13
26.04 LTSResolute Raccoon3.14
packages.ubuntu.com search results listing the default python3 package version for each Ubuntu release
packages.ubuntu.com shows the python3 version for each release, such as 3.12.3 on 24.04 LTS.
lsb_release -a        # which Ubuntu you're on
python3 --version     # which Python it has
which python3         # usually /usr/bin/python3

Method 1: Install Python on Ubuntu with apt

If the default version is new enough for you, apt is the simplest and most stable choice. Updates arrive with your normal system updates:

sudo apt update
sudo apt install python3 python3-pip python3-venv python3-dev
python3 --version
python3 -m pip --version

python3-venv is the piece people forget, and without it python3 -m venv fails. Add python3-dev if you’ll install packages that compile C code.

Want python to mean python3? Install python-is-python3, which adds that link for you.

Method 2: Install a newer Python with the deadsnakes PPA

Need a version your release doesn’t ship, like Python 3.13 on Ubuntu 24.04? The deadsnakes PPA packages other Python versions to sit alongside the system one:

The deadsnakes PPA page on Launchpad listing supported Ubuntu releases and Python versions
The deadsnakes PPA lists which Python versions it builds for each Ubuntu LTS release.
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.13 python3.13-venv
python3.13 --version

Run it with the full name, python3.13. Don’t point python3 at it with update-alternatives; that can break apt and other system tools that expect the default version.

Method 3: Install any Python version with uv

uv downloads standalone Python builds into your home folder, with no sudo and no PPA. I like it for projects that need a specific version:

curl -LsSf https://astral.sh/uv/install.sh | sh
uv python install 3.14
uv venv --python 3.14
source .venv/bin/activate
python --version

pyenv does a similar job by compiling Python from source, but uv is faster to set up. On Windows I use the same idea in installing multiple Python versions.

Installing packages with pip on Ubuntu

On Ubuntu 23.04 and newer, pip install into the system Python stops with error: externally-managed-environment. That’s deliberate, to keep pip from breaking packages apt installed.

The answer is a virtual environment per project. Inside it, pip works exactly as you’d expect:

mkdir ~/projects/weather && cd ~/projects/weather
python3 -m venv .venv
source .venv/bin/activate
pip install requests
deactivate

For command-line tools you want everywhere, like black or httpie, use pipx install black after sudo apt install pipx. More detail in Python virtual environments and pip install a specific version.

How do you fix python command not found on Ubuntu?

What you seeWhyFix
Command 'python' not foundUbuntu only provides python3Use python3 or sudo apt install python-is-python3
externally-managed-environmentpip into the system PythonCreate a venv, or use pipx for tools
ensurepip is not availablepython3-venv is missingsudo apt install python3-venv (or python3.13-venv)
Unable to locate package python3.13Not in your release’s archiveAdd the deadsnakes PPA, or use uv
ModuleNotFoundErrorPackage installed for another PythonActivate the venv, then python -m pip install

The last one has a whole guide: ModuleNotFoundError after pip install. If you’re also setting up a Mac, see how to install Python on Mac.

With Python installed, these are natural next steps:

Frequently asked questions

How do I install Python on Ubuntu Linux?

Run sudo apt update then sudo apt install python3 python3-pip python3-venv, and check with python3 --version.

Is Python preinstalled on Ubuntu?

Yes, on desktop and server images. Ubuntu 24.04 ships Python 3.12 and 26.04 LTS ships Python 3.14.

How do I install Python 3.13 on Ubuntu 24.04?

Add the deadsnakes PPA and run sudo apt install python3.13 python3.13-venv, or use uv python install 3.13.

Should I change the default python3 on Ubuntu?

No. System tools depend on it. Run other versions by their full name, or inside a virtual environment.

Why does pip say externally-managed-environment?

Ubuntu protects the system Python from pip. Use a virtual environment for projects and pipx for command-line tools.

Where are the official Linux instructions?

See Using Python on Unix platforms in the Python docs.