How to Install Python 3.10 on Ubuntu 20.04 LTS & Ubuntu 18.04

Python is a programming language that lets you work more quickly and integrate your systems more effectively.

You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs. [1]

How to Install Python 3.10 from source:

Dependencies:

Make sure your system is updated:
sudo apt update && sudo apt upgrade
Install required dependencies:
sudo apt install wget build-essential libreadline-gplv2-dev libncursesw5-dev \
     libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev
Download the archive from Python’s official site:
wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz 
Extract the archive:
tar xzf Python-3.10.0.tgz
Move to extracted directory:
cd Python-3.10.0 
Compile on your system
./configure --enable-optimizations 
Finally install on your system, make sure you are using altinstall command since this might replace your current Python version if you don’t use this command:
make altinstall
If that is successfully installed you can check the Python version:
python3.10 -V

or 

python3.10 --version
   

How to Install Python 3.10 from Repository:

Make sure your system is updated:
sudo apt update && sudo apt upgrade -y

Dependencies:

Install required dependencies:
sudo apt install software-properties-common -y
Add repository:
sudo add-apt-repository ppa:deadsnakes/ppa
CAUSION: This is a third party repository make sure its authenticated before using. Reporting Issues ================ Issues can be reported in the master issue tracker at: https://github.com/deadsnakes/issues/issues Finally install Python 3.10:
sudo apt install python3.10
    [1] https://www.python.org/ [2] https://alitech.io [3] https://www.hostingbyalitech.com