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 release | Codename | Default python3 |
|---|---|---|
| 22.04 LTS | Jammy Jellyfish | 3.10 |
| 24.04 LTS | Noble Numbat | 3.12 |
| 25.10 | Questing Quokka | 3.13 |
| 26.04 LTS | Resolute Raccoon | 3.14 |

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:

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 see | Why | Fix |
|---|---|---|
Command 'python' not found | Ubuntu only provides python3 | Use python3 or sudo apt install python-is-python3 |
externally-managed-environment | pip into the system Python | Create a venv, or use pipx for tools |
ensurepip is not available | python3-venv is missing | sudo apt install python3-venv (or python3.13-venv) |
Unable to locate package python3.13 | Not in your release’s archive | Add the deadsnakes PPA, or use uv |
ModuleNotFoundError | Package installed for another Python | Activate 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:
- How to run a Python script
- Environment variables in Python
- Python with open() as file
- Web scraping with Python
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.

Bijay Kumar is a 13-time Microsoft MVP with more than 18 years in software development, and the founder of Python Guides and TSinfo Technologies. He started out building .NET and SharePoint solutions at HP, TCS and KPIT before moving into Python, machine learning and AI, and he also builds web apps with TypeScript and React. He writes the tutorials here himself, and every example is run before publishing so you see the real output. More about Bijay · Microsoft MVP profile · LinkedIn