How to Install Python on Ubuntu 26.04
When you start a Python project on Ubuntu 26.04, you already have a Python interpreter available. The usual setup work is installing pip, adding the venv module, or installing a separate Python version for a project that needs something other than Ubuntu’s default Python.
This guide explains how to install Python tooling on Ubuntu 26.04, how to use the deadsnakes PPA for alternate Python versions, and how to build Python from source when you need a specific upstream release.
Ubuntu 26.04 Default Python Version
Ubuntu 26.04 ships with Python 3.14 as the default Python 3 interpreter. To check the version on your system, run:
python3 --versionPython 3.14.1
The exact patch version may change as Ubuntu publishes updates, but the default interpreter remains Python 3.14. Most users should keep this interpreter in place and use virtual environments for project packages.
Do not replace the /usr/bin/python3 interpreter. Ubuntu tools expect the distribution-provided Python version. If a project needs a different Python release, install it alongside the default interpreter and call it by its versioned command, such as python3.13 or python3.15.
Quick Reference
| Task | Command |
|---|---|
| Check Ubuntu’s default Python version | python3 --version |
| Install pip and venv for the default Python | sudo apt install python3-pip python3-venv |
| Create a virtual environment with the default Python | python3 -m venv myproject |
| Add deadsnakes PPA | sudo add-apt-repository ppa:deadsnakes/ppa |
| Install Python 3.13 from PPA | sudo apt install python3.13 |
| Install Python 3.15 preview from PPA | sudo apt install python3.15 |
| Install venv module for PPA Python | sudo apt install python3.13-venv |
| Create a virtual environment with PPA Python | python3.13 -m venv myproject |
| Activate virtual environment | source myproject/bin/activate |
| Deactivate virtual environment | deactivate |
| Build from source | ./configure --enable-optimizations && make -j $(nproc) |
| Install source build safely | sudo make altinstall |
Installing pip and venv for the Default Python
If Ubuntu’s default Python 3.14 is enough for your work, install pip and the virtual environment module from the Ubuntu repositories.
First, update the package index:
sudo apt updateInstall pip and the virtual environment module:
sudo apt install python3-pip python3-venvVerify the installed commands:
python3 --version
pip3 --versionOn Ubuntu 26.04, python3 points to Python 3.14. Use a virtual environment for project dependencies instead of installing packages into the system Python environment.
Create a virtual environment with the default Python:
python3 -m venv myprojectActivate it:
source myproject/bin/activateInside the environment, python and pip point to the isolated project environment:
python --version
python -m pip --versionWhen you are done working in the project, deactivate the environment:
deactivateInstalling Python from the Deadsnakes PPA
The deadsnakes PPA provides alternate Python versions packaged for Ubuntu. It now supports Ubuntu 26.04, including packages for Python versions that Ubuntu does not provide as the default interpreter.
Deadsnakes does not provide Python 3.14 for Ubuntu 26.04 because Ubuntu already includes Python 3.14. Use the PPA when you need another interpreter, such as Python 3.13 or the Python 3.15 preview builds.
-
Install the prerequisites and add the PPA:
Terminal sudo apt update sudo apt install software-properties-common sudo add-apt-repository ppa:deadsnakes/ppaPress
Enterwhen prompted to confirm. -
Install Python 3.13:
Terminal sudo apt update sudo apt install python3.13To install the Python 3.15 preview package instead, replace
python3.13withpython3.15:Terminal sudo apt install python3.15Python 3.15 is still a preview release, so use it for testing rather than production workloads.
-
Verify the installation:
Terminal python3.13 --versionThe command prints the installed Python 3.13 patch release. You can also confirm the binary location:
Terminal which python3.13 -
Install the
venvmodule for the same interpreter:Terminal sudo apt install python3.13-venvIf you installed Python 3.15, use:
Terminal sudo apt install python3.15-venv -
Create a virtual environment and use
pipinside it:Terminal python3.13 -m venv myproject source myproject/bin/activate python -m pip install --upgrade pip
python3 still points to Python 3.14. To use a PPA version, run python3.13, python3.15, or another explicit version command.Installing Python from Source
Compiling Python from source allows you to install any version and customize the build options. However, you will not be able to manage the installation through the apt
package manager.
The following steps show how to compile Python 3.14.4. If you are installing a different version, replace the version number in the commands below.
-
Install the libraries and dependencies required to build Python:
Terminal sudo apt update sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev liblzma-dev -
Download the source code from the Python download page using
wget:Terminal wget https://www.python.org/ftp/python/3.14.4/Python-3.14.4.tgz -
Terminal tar -xf Python-3.14.4.tgz -
Navigate to the source directory and run the
configurescript:Terminal cd Python-3.14.4 ./configure --enable-optimizationsThe
--enable-optimizationsflag runs profile-guided optimization tests, which makes the build slower but produces a faster Python binary. -
Start the build process:
Terminal make -j $(nproc)The
-j $(nproc)option uses all available CPU cores for a faster build. -
Install the Python binaries using
altinstall. Do not useinstall, as it overwrites the systempython3binary and can break system tools that depend on it:Terminal sudo make altinstall -
Verify the installation:
Terminal python3.14 --versionoutput Python 3.14.4
Setting Up a Virtual Environment
After installing a new Python version, create a virtual environment for your project to keep dependencies isolated:
python3.13 -m venv myprojectActivate the virtual environment:
source myproject/bin/activateYour shell prompt will change to show the environment name. Inside the virtual environment, python and pip point to the version you used to create it.
For a source-built Python 3.14 installation, use the versioned command:
python3.14 -m venv myprojectTo deactivate the virtual environment:
deactivateFor more details, see our guide on how to create Python virtual environments .
Optional: Uninstalling the PPA Version
To remove the PPA version:
sudo apt remove python3.13 python3.13-venvTo remove the PPA itself:
sudo add-apt-repository --remove ppa:deadsnakes/ppaTroubleshooting
python3 already exists after installation
This is expected. Ubuntu 26.04 includes Python 3.14 by default, so the default setup usually adds missing tools such as pip3 or venv.
pip reports an externally managed environment
Ubuntu protects system-managed Python packages. Create a virtual environment with python3 -m venv myproject, activate it, and install packages with python -m pip install package-name inside the environment.
No module named venv
Install the matching venv package. For Ubuntu’s default Python, run sudo apt install python3-venv. For Python 3.13 from the PPA, run sudo apt install python3.13-venv.
Unable to locate package python3.13 or python3.15
Run sudo apt update after adding the deadsnakes PPA. If the package is still unavailable, check that the PPA supports your Ubuntu release and CPU architecture.
python3 still shows Python 3.14
The python3 command should continue to use Ubuntu’s default interpreter. Run the alternate version with its versioned command, such as python3.13 or python3.15.
Python 3.15 shows an alpha version
Python 3.15 is still a preview release. Use it for testing compatibility, and use Python 3.14 or another stable release for production projects.
FAQ
Should I use the PPA or build from source?
Use the Ubuntu packages if Python 3.14 is enough. Use the deadsnakes PPA when you need an alternate packaged interpreter such as Python 3.13 or a Python 3.15 preview. Build from source only if you need a specific upstream patch release or a custom build configuration.
Will installing a new Python version break my system?
No. Both methods install the new version alongside the system Python 3.14. The system python3 command is not affected. You access the alternate version with python3.13, python3.15, or another explicit version command.
How do I make the new Python version the default?
You can use update-alternatives to configure it, but this is not recommended. Many Ubuntu system tools depend on the default python3 being the version that shipped with the OS. Use virtual environments instead.
How do I install pip for the new Python version?
The recommended approach is to use a virtual environment. Install the matching venv package, create a venv, activate it, and use python -m pip inside the environment.
What is the difference between install and altinstall when building from source?altinstall installs a versioned binary such as python3.14 without creating a python3 symlink. install creates the symlink, which overwrites the system Python and can break Ubuntu system tools.
Does Ubuntu 26.04 include pip by default?
Ubuntu 26.04 includes Python 3.14 but does not include pip in the base installation. Install it with sudo apt install python3-pip. For alternate Python versions, use python -m pip inside a virtual environment.
Conclusion
Stick with Ubuntu’s Python 3.14 plus python3-pip and python3-venv for most projects. Reach for the deadsnakes PPA when a project pins to 3.13 or wants to test the 3.15 preview, and build from source only for a specific upstream patch.
For more on Python package management, see our guide on how to use pip .







































