Install Python 3.13 on Ubuntu 24.04|22.04|20.04|18.04

For this tutorial, we will install Python 3.12 from the deadsnakes PPA.

sudo apt update && sudo apt upgrade -y
sudo apt install -y software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install -y python3.13 python3.13-dev python3.13-venv

# To check if the install is successful
python3.13 --version

If you get this error ImportError: cannot import name 'html5lib' from 'pip._vendor' (/usr/lib/python3/dist-packages/pip/_vendor/init.py) , that means you need to re-install pip that matched the new python

curl -sS https://bootstrap.pypa.io/get-pip.py | python3.13

One comment

Leave a Reply