How to install python 3. 11 on ubuntu 20. 04

How to Install Python 3.11 on Ubuntu 20.04

Python is regarded as one of most popular , multi-purpose and beginner-friendly programming languages. It’s used in a wide selection of areas including data science, machine learning, rapid prototyping, and creating web applications.

Python 3.11 was released a few months ago this year, October, 2022 and provides a wide array of improvements such as faster speed of execution, better error diagnostics, and improved modules to mention just a few.

In this guide, we will walk you through the installation of Python 3.11 on Ubuntu 20.04

Step 1: Update the system & Install dependencies

As we set sail, the first step is to install dependencies that will be required during the installation of Python 3.11. But first, refresh the Ubuntu package lists as follows.

$

Sponsored
sudo apt update

How to install python 3. 11 on ubuntu 20. 04 1

Next , install the software-properties-common package. This provides an abstraction of APT repositories and provides some useful scripts that help you manage software applications from third-party vendors such as PPAs.

See also  Ubuntu 20.04 LTS end of life: standard support is coming to an end. Here’s how to prepare. 
$ sudo apt install software-properties-common

How to install python 3. 11 on ubuntu 20. 04 2

Once the software-properties-common package is in place, let’s head over to the next step.

Step 2: Install Python3.11 on Ubuntu

To successfully install Ubuntu, we need to add the deadsnakes PPA which provides the most recent versions of Python such as Python 3.7 and 3.8 for Ubuntu 18.04 and Python 3.9 to Python 3.11 For both Ubuntu 18.04 and Ubuntu 20.04.

So, proceed with the addition of the deadsnakes PPA.

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

How to install python 3. 11 on ubuntu 20. 04 3

To continue adding the PPA, proceed and hit ENTER.

How to install python 3. 11 on ubuntu 20. 04 4

Next, update the package lists to sync your system with the newly added deadsnakes PPA.

$ sudo apt update

How to install python 3. 11 on ubuntu 20. 04 5

Finally, use the APT command to install Python 3.11as shown.

$ sudo apt install python3.11

How to install python 3. 11 on ubuntu 20. 04 6

Sponsored

To confirm that Python3.11 is installed, run the command:

$ python3.11 —-version

How to install python 3. 11 on ubuntu 20. 04 7

Install additional Python packages

Additionally, there are some useful packages that supplement the default Python installation that you might consider installing.

Consider installing development headers for building and compiling C extensions as follows.

$ sudo apt install python3.11-dev

How to install python 3. 11 on ubuntu 20. 04 8

Also, consider installing the standard library `dbm.gnu` module

$ sudo apt install python3.11-gdbm

How to install python 3. 11 on ubuntu 20. 04 9

And lastly, feel free to install the Python venv module that allows you to create virtual environments.

$ sudo apt install python3.11-venv

How to install python 3. 11 on ubuntu 20. 04 10

You can also consider installing the Tkinter Python Library as shown

$ sudo apt install python3.11-tk

How to install python 3. 11 on ubuntu 20. 04 11

Accessing the Python 3.11 shell

To access the Python shell run the command:

$ python3.11

From here, you can run your Python code. In the snippet below, we have created and execute a simple program that sums two numbers.

How to install python 3. 11 on ubuntu 20. 04 12

Conclusion

And that’s it, we have managed to successfully install Python 3.11 on Ubuntu 20.04.

Karim buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications including CCNA RS, SCP, and ACE. As an IT engineer and technical author, he writes for various websites.


Discover more from Ubuntu-Server.com

Subscribe to get the latest posts sent to your email.

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply