How to Install Python 3.10 in Ubuntu and Other Related Linux

2 min


Planning to get the Python 3.10 installed for your work? Here’s how to install Python 3.10 in Ubuntu and related distributions.

Python 3.10 released on Oct 25, 2021 with additional features and updates. This release brings better handling of error messages, new patter matching features, TypeAlias, user-defined type guards and more. You can read the release highlights here.

As of writing this guide, Python 3.10 is adopted by Fedora 35. However, Ubuntu 21.10 Impish Indri still features Python 3.9.x. The planned Ubuntu 22.04 LTS, would have the Python 3.10 by default.

That said, if you need Python 3.10, right now in Ubuntu 21.10, Ubuntu 21.04 or prior-LTS releases which are still supported, you can use the below reliable PPA to install the latest Python 3.10 in Ubuntu. Here’s how.

How to Install Python 3.10 in Ubuntu

This PPA can be used for Ubuntu 21.10, Ubuntu 21.04, Ubuntu 20.04 LTS, Ubuntu 18.04 LTS, Linux Mint 20.x, Elementary OS 6 and other related Ubuntu-based distributions.

  • Open a terminal prompt and add the following PPA.
sudo add-apt-repository ppa:deadsnakes/ppa
  • Refresh the cache using the below command.
sudo apt update 
  • And install Python 3.10 using below command.
sudo apt install python3.10

Set Python Versions

Setting up the Python 3.10 as default require some additional steps. Follow along. 

Warning: There are many applications in your Ubuntu system which depends on stock version of Python 3.9. Hence, be very sure that your work applications (e.g. GIMP, GNOME Terminal etc.) are compatible with Python 3.10. So, be cautious.

Quick Tip: If you want to check which of your installed system packages depends on a specific version, use the following rdepend switch of apt-cache command. In the below example, I am checking which of the installed packages depends on Python 3.8.

apt-cache rdepends python3.8
[~]$ apt-cache rdepends python3.8
python3.8
Reverse Depends:
python3.8-dbg
virtualbox
python3.8-venv
python3.8-full
libpython3.8-testsuite
libglib2.0-tests
idle-python3.8
idle-python3.8
python3.8-minimal
python3.8-doc
python3.8-dev
python3.8-dbg
python3-uno
gedit
virtualbox
stimfit
python3.8-venv
python3-stfio
python3-escript-mpi
python3-escript
python3-csound
pitivi
obs-studio
liferea
libpython3.8-testsuite
libglib2.0-tests
kitty
kdevelop-python
idle-python3.8
idle-python3.8
rhythmbox-plugins
python3.8-minimal
python3.8-doc
python3.8-dev
python3
python3-uno
python3-all
cluster-glue
gedit
[~]$

Use Python 3.10 as default Python3

  • First, check the current default version using the below command from the terminal.
python3 --version
  • Use update-alternatives to create symbolic links to python3
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2
  • And choose which one to use as Python3 via command:
sudo update-alternatives --config python3
Install Python 3.10 in Ubuntu
Install Python 3.10 in Ubuntu

That’s all for the steps. Now you can start using the latest Python in your current Ubuntu version for your work/study. At any given time, you switch over to the stock version using the above commands and by changing the version numbers.


We bring the latest tech, software news and stuff that matters. Stay in touch via Telegram, Twitter, YouTube, and Facebook and never miss an update!

Join our Telegram channel and stay informed on the move.

Also Read


Like it? Share with your friends!

Arindam

Creator of debugpoint.com. All time Linux user and open-source supporter. Connect with me via Telegram, Twitter, or send us an email.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

4 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
4
0
Would love your thoughts, please comment.x
()
x