Installing Python 3.10
This method is no longer recommended.
Instead you should use the UV Package Manager, which also supports easily installing multiple python versions.
Firstly, update your repository listings and system packages.
$ sudo apt update && sudo apt upgrade -y
Once that is done we can proceed to install the required dependencies.
$ sudo apt install software-properties-common -y
Then add the deadsnakes PPA to the APT Sources List.
$ sudo add-apt-repository ppa:deadsnakes/ppa
You will see the following output:
..........
To install 3rd-party Python modules, you should use the common Python packaging tools.
For an introduction into the Python packaging ecosystem and its tools, refer to the Python Packaging User Guide:
https://packaging.python.org/installing/
Sources
=======
The package sources are available at:
https://github.com/deadsnakes/
Nightly Builds
==============
For nightly builds, see ppa:deadsnakes/nightly https://launchpad.net/~deadsnakes/+archive/ubuntu/nightly
More info: https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa
Press [ENTER] to continue or ctrl-c to cancel adding it
After this we can install Python 3.10.
sudo apt install python3.10
Done!