Skip to content

Instantly share code, notes, and snippets.

@rutcreate
Last active January 19, 2026 07:50
Show Gist options
  • Select an option

  • Save rutcreate/c0041e842f858ceb455b748809763ddb to your computer and use it in GitHub Desktop.

Select an option

Save rutcreate/c0041e842f858ceb455b748809763ddb to your computer and use it in GitHub Desktop.
Install Python 3.10.x on Ubuntu 20.04

Prerequisite

sudo apt update
sudo apt install software-properties-common -y

Add custom APT repository

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update

Press ENTER to confirm adding repository.

Install Python 3.10

sudo apt install python3.10 python3.10-venv python3.10-dev
python3 --version

You will see previous of Python. At the writing time Python 3.8.10

Make symbolic link (Optional)

Caution

This may cause problem with terminal not open on Ubuntu

https://askubuntu.com/questions/1397938/terminal-not-opening-after-changing-python-version

ls -la /usr/bin/python3
sudo rm /usr/bin/python3
sudo ln -s python3.10 /usr/bin/python3
python3 --version

Now you will see Python 3.10.x

Install PIP for Python 3.10

curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10
python3.10 -m pip --version

Test with system ENV

python3.10 -m pip install ipython

Test with Virtual ENV

python3.10 -m venv venv
pip install ipython

References

https://computingforgeeks.com/how-to-install-python-on-ubuntu-linux-system/

@fransf-wtax
Copy link

I don't think this works anymore. The Packages.gz for focal in this PPA is empty: http://ppa.launchpad.net/deadsnakes/ppa/ubuntu/dists/focal/main/binary-amd64/Packages.gz . So I think that means there's no packages for Ubuntu 20.04 there and this won't work (anymore) for that Ubuntu version.

@kolyabres
Copy link

you can run instead

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment