Install Python 3.11 on Ubuntu 22.04|20.04|18.04

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

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

# To check if the install is successful
python3.11 --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.11

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *