Install Python 3.10 on Ubuntu 20.04

Python is a programming language that is used to implement various kinds of applications. Python is often used for machine learning, deep learning, computer vision, and data analysis.

This tutorial demonstrates how to install Python 3.10 on Ubuntu 20.04.

Install Python

Add the Python repository:

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

Install Python 3.10:

sudo apt install -y python3.10

Verify that the installation completed successfully by checking Python version:

python3.10 --version

Testing Python

Create a main.py file:

nano main.py

Add the following code:

print('Hello world')

Now test a program by running python3.10 command:

python3.10 main.py

Uninstall Python

If you wish to completely remove Python and related dependencies, use the following command:

sudo apt purge --autoremove -y python3.10

Remove GPG key and repository:

sudo rm -rf /etc/apt/trusted.gpg.d/deadsnakes_ubuntu_ppa.gpg
sudo rm -rf /etc/apt/sources.list.d/deadsnakes-ubuntu-ppa-focal.list

Leave a Comment

Your email address will not be published. Required fields are marked *