'add python 3.10 on ubuntu

I'm just started using ubuntu and tried to upgrade python from 3.8.10 -> 3.10.4 in my venv with the following commands:

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

it is installed successfully but when I check the version with:

python3 --version

it still show:

python 3.8.10

and my code can only work with python version > 3.10. How can I fix this?



Solution 1:[1]

I'm also using the deadsnakes PPA. Every version is installed separately, so you can switch versions on the fly. So to use any version installed from deadsnakes, you have to call it explicitely.

$ python3.10 --version
Python 3.10.4

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sören