How to install Python to Debian/Ubuntu

Installing the Python version supported by your Debian or Ubuntu operating system is fairly straightforward. Use the following commands:

$ sudo apt update
$ sudo apt install python3

Note: The above commands will install the default Python3 version that comes with your specific Debian or Ubuntu version.

To install a more recent Python version on your Debian or Ubuntu system, you can use the deadsnakes PPA (Personal Package Archive). The deadsnakes PPA is an unofficial but known source for newer versions of Python.

$ sudo apt install software-properties-common
$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt update
$ sudo apt install python3.11

Important: Be sure to replace ‘3.11’ with the specific version of Python you wish to install.

Disclaimer: While the deadsnakes PPA is a popular source for newer Python versions, it’s important to understand that these are not officially supported by the Debian or Ubuntu teams. If you’re working on a production system, you should thoroughly test any new Python versions in a development environment before deploying them to production.

Check your Python Version: After the installation, you can confirm the Python version installed by typing the following command:

$ python3 --version

This command will display the version of Python3 installed on your system.

Happy Pythoning!

Leave a Reply

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