| Tested on | Ubuntu 26.04 LTS (Resolute Raccoon) Ubuntu 24.04 (noble) & 22.04 (jammy) — Deadsnakes package names verified |
|---|---|
| Package | python3.15 3.15.0-1+resolute1 (Deadsnakes)python3 3.14.4 (Ubuntu default on 26.04 lab) |
| Applies to | Ubuntu 22.04 LTS, 24.04 LTS, and 26.04 LTS |
| Privilege | sudo for apt and PPA; normal user for pyenv, uv, and venv work |
| Scope | Install the current upstream stable Python (3.15 at time of writing) beside Ubuntu's system python3, pick a safe install method, create a virtual environment, and avoid breaking apt. Does not replace version-specific walkthroughs—use the Python 3.11–3.15 install guides when an app pins a minor version. |
| Related guides | Install Python 3.15 on Ubuntu Install Python 3.14 on Ubuntu Install Python 3.13 on Ubuntu pip command not found Uninstall Python on Ubuntu Python tutorial |
Ubuntu pins python3 so apt, cloud-init, and system packages keep a stable interpreter. When sudo apt install python3 is already the newest package but you need a newer line for your own code, that is normal—not a failed upgrade.
Upstream means releases published by the Python project at python.org, not Ubuntu's distro-packaged python3. Python 3.15.0 became the current stable CPython release on October 9, 2026; older guides that still call 3.15 a beta or preview are outdated.
This guide:
- Installs the latest stable upstream Python (currently 3.15) next to the release default
- Walks through Deadsnakes, pyenv, uv, and optional source
altinstall - Shows how to create a venv and use
python -m pipwithout touching/usr/bin/python3
Lab notes:
- Deadsnakes and venv steps were run on Ubuntu 26.04; package names match the Deadsnakes PPA on jammy, noble, and resolute
- PPA setup uses add-apt-repository when
add-apt-repositoryis missing - Pinned minors (for example 3.11 on 24.04) belong on Install Python 3.11 on Ubuntu—not duplicated here
- On Debian, see install latest Python on Debian (no Deadsnakes PPA)
Quick answer: install the latest Python on Ubuntu
The current upstream stable release is Python 3.15. On Ubuntu LTS:
- Install with the Deadsnakes PPA, pyenv, or uv—not by replacing
/usr/bin/python3 - After the interpreter exists, create a venv with that versioned binary
- Use
python -m piponly inside the venv (or with the versioned interpreter you chose)
Fastest packaged route: Deadsnakes (versioned apt packages). For per-release candidates, uninstall steps, and 3.15-specific troubleshooting, see Install Python 3.15 on Ubuntu. On a normal development workstation, pyenv or uv is often a better fit when you want the newest upstream Python without tying projects to a PPA.
Package installs below use apt. Refresh indexes before adding packages:
sudo apt updateInstall helper tools for the Deadsnakes path:
sudo apt install software-properties-commonAdd the PPA and refresh again:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt updateConfirm Deadsnakes offers a 3.15 candidate for your suite (jammy, noble, or resolute) before installing:
apt-cache policy python3.15 python3.15-venvIn that output, Candidate is the version APT would install if you ran sudo apt install python3.15 now.
Install Python 3.15 and its venv module:
sudo apt install python3.15 python3.15-venvConfirm Ubuntu's default python3 did not change:
python3 --version
python3.15 --version
command -v python3
command -v python3.15On the 26.04 lab host after Deadsnakes:
Python 3.14.4
Python 3.15.0
/usr/bin/python3
/usr/bin/python3.15Create a project environment (a venv does not download Python—it only isolates packages after you install python3.15):
python3.15 -m venv ~/venvs/latest-py
source ~/venvs/latest-py/bin/activate
python --version
python -m pip install --upgrade pipFor a focused 3.15-only walkthrough (per-release notes, uninstall, and upgrades), see Install Python 3.15 on Ubuntu.
Latest Python vs Ubuntu's system Python
| Source | What it is | Typical use |
|---|---|---|
python3 → /usr/bin/python3 |
Ubuntu-owned default for the release | Leave it for apt and OS tools |
python3.15, pyenv, or uv-managed builds |
Interpreter you add for applications | Project development and testing |
~/venvs/... or ./.venv |
Virtual environment | pip installs for one project only |
Upstream downloads and release notes live on python.org. Ubuntu documents keeping development Python separate from the system install and recommends pyenv for multiple versions in its Python packaging guide.
Current Python versions on Ubuntu 26.04, 24.04, and 22.04
| Ubuntu release | Default python3 |
Latest upstream (Oct 2026) | Recommended approach |
|---|---|---|---|
| 26.04 LTS (resolute) | Python 3.14 | Python 3.15 | Keep 3.14 as system python3; add 3.15 for projects |
| 24.04 LTS (noble) | Python 3.12 | Python 3.15 | Add 3.15 beside system Python |
| 22.04 LTS (jammy) | Python 3.10 | Python 3.15 | Add 3.15 beside system Python |
Confirm your release row with check Ubuntu version commands, then compare defaults:
. /etc/os-release && echo "$PRETTY_NAME"
python3 --version
readlink -f /usr/bin/python3Example on Ubuntu 26.04:
Ubuntu 26.04 LTS
Python 3.14.4
/usr/bin/python3.14Why you should not replace /usr/bin/python3
Ubuntu tools and many .deb packages expect the release default python3. Replacing it breaks:
aptand unattended upgrades- Services that call
/usr/bin/python3directly .debpackages that declare apython3dependency
Do not:
sudo rm /usr/bin/python3or symlink another version over itsudo ln -sf /usr/local/bin/python3.15 /usr/bin/python3- Run
sudo update-alternatives --config python3to “upgrade” system Python
Safe layout:
┌─────────────────────┐
│ Ubuntu system │
└──────────┬──────────┘
│
┌───────────────┴───────────────┐
v v
┌─────────────────┐ ┌──────────────────┐
│ /usr/bin/python3│ │ python3.15 │
│ DO NOT REPLACE │ │ (Deadsnakes / │
│ apt & OS tools │ │ pyenv / uv) │
└─────────────────┘ └────────┬─────────┘
v
┌──────────────────┐
│ project/.venv/ │
│ pip packages │
└──────────────────┘Choose a safe Python installation method
| Method | Best for | Jump to |
|---|---|---|
| Ubuntu APT | You only need the default python3 for this release |
When APT is enough |
| Deadsnakes PPA | Packaged python3.15 (or other minors) beside system python3 |
Deadsnakes |
| pyenv | Compile and manage multiple interpreter versions per user | pyenv |
| uv | Managed CPython distributions plus project/environment tooling | uv |
Source make altinstall |
Exact tarball, no PPA—advanced | Source build |
Trade-offs at a glance:
- Deadsnakes — versioned
.debpackages and commands such aspython3.15; tied to a third-party PPA - pyenv — compiles interpreters under
~/.pyenv; best when you switch versions often - uv — Astral-managed CPython builds and fast venv workflows under your home directory
- All three leave
/usr/bin/python3alone when you follow this guide
For a normal development workstation, pyenv or uv is a strong default when you primarily need the newest upstream Python. Use Deadsnakes when you specifically want Ubuntu-style versioned packages from apt. Build from source only when you need the exact upstream tarball or custom compile options (see Advanced source build).
When Ubuntu APT is enough
If the default python3 already matches your project, install the distro packages only:
sudo apt update
sudo apt install python3 python3-venvOn 24.04, that is typically Python 3.12; on 26.04, Python 3.14. Use Install Python 3.14 on Ubuntu when you need 3.14 on an older LTS, or Install Python 3.12 on Ubuntu when 3.12 is the target on 22.04 or 26.04.
Install the latest Python with Deadsnakes
A PPA (Personal Package Archive) is an extra APT repository on Launchpad. Deadsnakes uses one to package alternate Python versions Ubuntu does not ship as the release default. It is community-maintained, not part of Ubuntu's official archive—convenient for versioned packages, but security-update timing and repository lifecycle are separate from Canonical's packages.
Deadsnakes publishes stable python3.15 builds for jammy, noble, and resolute (including 3.15.0 packages published after the 3.15.0 stable release).
Add the PPA if you have not already:
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt updateCheck the APT candidate before you install (stale prerelease names or a missing suite show up here):
apt-cache policy python3.15 python3.15-venvIn apt-cache policy output, Candidate is the version APT would install if you ran sudo apt install python3.15 now.
Install the interpreter and venv support:
sudo apt install python3.15 python3.15-venvAdd python3.15-dev only when you compile C/C++ extensions, embed Python, or need development headers—not for a typical venv + pip workflow.
Verify the versioned binary and confirm system python3 is unchanged:
python3.15 --version
command -v python3.15
python3 --version
command -v python3Sample output on Ubuntu 26.04:
Python 3.15.0
/usr/bin/python3.15
Python 3.14.4
/usr/bin/python3Upgrade patch releases when apt offers them:
sudo apt update
sudo apt install --only-upgrade python3.15 python3.15-venvFor uninstall steps and version-specific troubleshooting, see Install Python 3.15 on Ubuntu and Uninstall Python on Ubuntu.
Install the latest Python with pyenv
pyenv installs interpreters under ~/.pyenv/versions/ and is a good fit when you switch between many minors on one account. Ubuntu's developer documentation describes pyenv for managing multiple versions without touching system Python.
Install build dependencies once (or run upstream pyenv install-prerequisites on supported distros if you prefer pyenv's maintained list):
sudo apt update
sudo apt install build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev curl git libncursesw5-dev xz-utils tk-dev \
libxml2-dev libxmlsec1-dev libffi-dev liblzma-devInstall pyenv (official installer):
curl -fsSL https://pyenv.run | bashAdd pyenv to your shell (bash example—restart the shell or source ~/.bashrc afterward):
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"Install and select Python 3.15 for the current directory:
pyenv install 3.15.0
pyenv local 3.15.0
python --version
command -v pythonpython should resolve through ~/.pyenv/shims while /usr/bin/python3 stays on the Ubuntu default.
Create a venv with the pyenv-selected interpreter:
python -m venv .venv
source .venv/bin/activate
python -m pip --versionFor many versions on one machine, see also Install Python 3.13 on Ubuntu and sibling guides when you pin older lines.
Optional: Install the latest Python with uv
uv installs managed CPython builds under your user data directory (not /usr/bin). It is a fast option when you want upstream builds without compiling and without adding a PPA.
Install uv:
curl -LsSf https://astral.sh/uv/install.sh | shInstall Python 3.15:
uv python install 3.15
uv python listuv notes:
- Python.org does not publish official Linux binary distributions; uv uses Astral-managed standalone CPython builds
- Fits developer workstations, not replacing Ubuntu's
python3package
Create a venv with uv:
uv venv --python 3.15 .venv
source .venv/bin/activate
python --versionAdvanced: Build the latest Python from source safely
Use a source build when you need the exact python.org tarball and neither Deadsnakes nor uv fits. Install build libraries that match the modules you plan to import—missing -dev packages often surface as failed import lzma or import ssl after compile.
Install build dependencies aligned with Python's build guidance:
sudo apt update
sudo apt install build-essential pkg-config curl \
zlib1g-dev libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev \
liblzma-dev libncurses-dev libreadline-dev libsqlite3-dev \
libssl-dev tk-dev uuid-devDownload the current 3.15.x tarball (adjust the version if a newer patch is current). Optionally verify the archive against the SHA-256 sum on the python.org release page before building. The download uses curl and tar:
cd /tmp
curl -fsSLO https://www.python.org/ftp/python/3.15.0/Python-3.15.0.tgz
tar -xf Python-3.15.0.tgz
cd Python-3.15.0Configure with a dedicated prefix so files stay out of Ubuntu's python3, then use make altinstall so the build installs a versioned python3.15 under that prefix—not a generic python3 that could shadow other interpreters:
./configure --prefix=/opt/python-3.15
make -j"$(nproc)"
sudo make altinstallVerify:
/opt/python-3.15/bin/python3.15 --version
python3 --versionSystem python3 must still report the Ubuntu default. Add /opt/python-3.15/bin to your PATH only when you intend to use that build. When 3.15 is the target, Install Python 3.15 on Ubuntu covers Deadsnakes-centric upgrade and removal paths in more detail.
Create a virtual environment with the new Python
A virtual environment does not install another Python. It only isolates packages after python3.15 (or another interpreter) exists.
Install the matching -venv package when you used Deadsnakes:
sudo apt install python3.15-venvCreate and activate an environment:
python3.15 -m venv ~/venvs/myproject
source ~/venvs/myproject/bin/activate
python --versionProve SSL, SQLite, and common extension modules work:
python -m pip install --upgrade pip
python -c "import ssl, sqlite3, bz2, lzma; print('Python environment OK')"Sample on the 26.04 lab:
Python 3.15.0
Python environment OKInstall packages only inside the venv:
python -m pip install requestsIf python3 -m pip install on system python3 fails with externally-managed-environment, that is PEP 668 protecting Ubuntu's interpreter—use a venv instead of sudo pip. See pip command not found when pip itself is missing.
Deactivate with deactivate. For packaging workflows, see create a Python package.
Update and uninstall alternate Python on Ubuntu
| How you installed | Update | Remove |
|---|---|---|
| Deadsnakes | sudo apt update && sudo apt install --only-upgrade python3.15 python3.15-venv |
sudo apt remove python3.15 python3.15-venv (do not remove system python3) |
| pyenv | pyenv install newer patch, pyenv local |
pyenv uninstall 3.15.0 |
| uv | uv python install 3.15 again |
uv python uninstall 3.15 |
/opt/python-3.15 source |
Rebuild from newer tarball into same prefix | Remove the prefix directory |
Never purge Ubuntu's python3 metapackage or the release-owned Python interpreter to “remove Python.”
Troubleshooting latest Python installs on Ubuntu
| Symptom | Likely cause | Fix |
|---|---|---|
python3 still shows an old version |
Expected—new install is versioned | Use python3.15 or a venv |
python3.15: command not found |
Package not installed or wrong series | Add Deadsnakes PPA, sudo apt update, install python3.15 |
Unable to locate package python3.15 |
PPA missing, stale cache, or no candidate | apt-cache policy python3.15; re-add PPA and sudo apt update |
import lzma / import ssl fails after source build |
Missing -dev library at compile time |
Install the matching dev package, wipe the build tree, reconfigure, rebuild |
externally-managed-environment |
pip on system python3 |
python3.15 -m venv then python -m pip inside |
pip targets wrong Python |
Multiple installs on PATH |
python -m pip from the intended interpreter |
ensurepip / venv errors |
Missing -venv package |
sudo apt install python3.15-venv |
| System Python changed after experiments | Symlink or update-alternatives |
Restore Ubuntu python3 packages; do not repoint /usr/bin/python3 |
Summary: install the latest Python on Ubuntu
Ubuntu keeps a stable python3 per release while upstream CPython advances—3.15 is the current stable line at time of writing.
- Install 3.15 beside system Python with Deadsnakes, pyenv, or uv
- Reserve source
altinstallor a dedicated/optprefix for advanced cases - Never replace
/usr/bin/python3or useupdate-alternativesto “upgrade” Ubuntu's Python
After python3.15 exists:
- Create a venv with
python3.15 -m venv(a venv isolates packages; it does not download Python) - Install dependencies with
python -m pipinside that environment - For web apps, continue with Install Flask on Ubuntu using the same venv pattern
When an application pins an older minor, use the matching install guide linked earlier in this page (3.11, 3.12, 3.13, or 3.14).
References
- Python downloads
- Python 3.15.0 release
- Deadsnakes PPA
- Ubuntu for developers — Package Python applications
- PEP 668 — externally managed environments
- pyenv
- uv — Python versions
Frequently Asked Questions
What is the latest Python version?
Upstream stable CPython is 3.15.0 as of October 2026. Ubuntu LTS releases ship an older default python3 for stability—install 3.15 beside it when your own projects need the newest line.
What Python does Ubuntu 26.04 use?
The default python3 package targets Python 3.14. You can install 3.15 from Deadsnakes or pyenv without changing /usr/bin/python3.
What Python does Ubuntu 24.04 use?
Python 3.12 is the typical default. Install 3.15 or another minor from Deadsnakes when applications require it.
Is it safe to upgrade Python on Ubuntu?
Safe for your projects means adding a new interpreter and moving work into a venv. It is not safe to replace system python3 or run sudo pip against it.
Should I use Deadsnakes, pyenv, or uv?
Deadsnakes fits when you want versioned apt packages such as python3.15. pyenv fits when you compile and switch among many versions per directory. uv fits when you want managed CPython plus fast project venvs without a PPA.
Does a virtual environment install another Python version?
No. A venv reuses whichever interpreter you pass to -m venv (for example python3.15). Install that binary first, then create the environment.
Can Python 3.15 and Ubuntu's Python exist together?
Yes. Expect python3 to stay on the Ubuntu default and python3.15 (or pyenv shims) for application work.

