NEW VPS PLANS

Experience Ultra-high Performance of NVMe Storage on New UK VPS Plans.

Deploy Instantly
  • +357 2425 0808
  • Login
  • English

Home

Blog

How To Install Latest Python 3.11 on Ubu...

How To Install Latest Python 3.11 on Ubuntu Server

How To Install Latest Python 3.11 on Ubuntu Server

NetShop ISP

NetShop ISP · Blog Author

Dec 03, 2022 · Technical Tutorials

Python is one of the most popular and fastest-growing object-oriented programming languages. Python is mostly used for building websites, applications for mobile, web and desktop. It is also the programming language of choice for automating tasks and conducting data analysis.

At the time of writing this article (December 2022) there are two main Python versions being used; Python v2 and v3. Whilst Python 2 will see no major releases, the v3 is under active development and has already seen a lot of stable releases. Currently, the latest stable version is 3.11 which was released on Oct. 24, 2022.

In this article we will demonstrate how to install the latest Python 3.11 version on an Ubuntu server via the apt package manager, and also how to set the default Python version in case you have multiple versions installed on your server.

Install Python 3.11 on Ubuntu using apt

In this tutorial we will be using the “deadsnakes” repository as it contains the more recent Python versions ready for Ubuntu.

Pre-requisites

  1. root access (or any sudo level user account)
  2. Ubuntu server (in this tutorial we are using Ubuntu Server 22.10)

Easy Steps to Install Python 3.11 on Ubuntu

Login to your Ubuntu server and type the following commands:

root@ubuntu-server:~$ sudo add-apt-repository ppa:deadsnakes/ppa
root@ubuntu-server:~$ sudo apt update
root@ubuntu-server:~$ sudo apt install python3.11

By adding the repository ppa:deadsnakes/ppa allows us to install other versions as well. See below the commands for installing old python versions.

root@ubuntu-server:~$ sudo apt install python3.11
root@ubuntu-server:~$ sudo apt install python3.10
root@ubuntu-server:~$ sudo apt install python3.7

Finally, type the following command to see all Python binaries installed on your Ubuntu server.

root@ubuntu-server:~$ ls -l /usr/bin/python*

Sample Output:

lrwxrwxrwx 1 root root      10 Dec 2  2022 /usr/bin/python3 -> python3.10
-rwxr-xr-x 1 root root 5901416 Dec  2  2022 /usr/bin/python3.10
-rwxr-xr-x 1 root root 6705016 Dec 3 09:45 /usr/bin/python3.11
-rwxr-xr-x 1 root root     960 Dec 2  2022 /usr/bin/python3-futurize
-rwxr-xr-x 1 root root     964 Dec 2  2022 /usr/bin/python3-pasteurize

In our system, the default Python version used is 3.10, as indicated by the symlink:
lrwxrwxrwx 1 root root 10 Dec 2 2022 /usr/bin/python3 -> python3.10

We can also verify the current Python version by executing the following command:

root@ubuntu-server:~$ python -V

Sample Output:

Python 3.10.4
To use Python 11 whilst maintaining an older version as default, type the following command and hit 'Enter':
root@ubuntu-server:~$ python3.11

By doing so you will enter the Python Shell. To exit the Python interpreter, type the following commands within the shell and then press ‘Enter’:

quit()
OR
exit()

Change Default Python Version on Ubuntu Server

In the case you have multiple Python versions installed, you can change the default version as follows. In our example, our Ubuntu server had as default Python 3.10 and we will change it to Python 3.11.

root@ubuntu-server:~$ python3 --version
root@ubuntu-server:~$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
root@ubuntu-server:~$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2
root@ubuntu-server:~$ sudo update-alternatives --config python3
root@ubuntu-server:~$ python3 --version

That’s all! If you followed all the steps above you have successfully installed Python 3.11 on your Ubuntu server!

Press Releases
72

Free VPS Trial

No Credit Card Required.

Recent Posts

Introducing New Cutting-Edge VPS Plans: OKTAPLUS, HYPER, and TITAN Enhanced with NVMe Technology

Introducing New Cutting-Edge VPS Plans: OKTAPLUS, HYPER, and TITAN Enhanced with NVMe Technology

12 March, 2024

How To Install Let’s Encrypt SSL on Ubuntu Server 22.04 for Apache or Nginx

How To Install Let’s Encrypt SSL on Ubuntu Server 22.04 for Apache or Nginx

04 March, 2024

Navigating Forex Server Hosting: Key Distinctions from Conventional Providers

Navigating Forex Server Hosting: Key Distinctions from Conventional Providers

23 February, 2024

How to Install Nginx, MariaDB, PHP-FPM on AlmaLinux 9 Server (LEMP)

How to Install Nginx, MariaDB, PHP-FPM on AlmaLinux 9 Server (LEMP)

16 February, 2024

How To Reset Forgotten MySQL 5.7 Root Pass in Linux

How To Reset Forgotten MySQL 5.7 Root Pass in Linux

09 February, 2024

#letushostyou

Award Winning Hosting Provider established in 2004.

120 Faneromenis Avenue, Imperial Tower, 2nd Floor, Larnaca 6031, Cyprus

Products

Bare Metal Servers

Customized Servers

Virtual / Cloud Servers

Forex VPS

Storage VPS

cPanel Web Hosting

Reseller Web Hosting

Colocation

Addons

Premium DNS

Email Hosting

Cloud Backup

DDoS Protection

Licenses

SSL Certificates

Domain Names

Premium SLAs

About Us

Data Center Locations

Looking Glass

Our Company

Contact Us

Careers in Cyprus

Become a Partner

Awards

Certifications

© 2024 S.S. NetShop Internet Services Ltd. All rights reserved.  Terms & Conditions  |  Privacy Policy
CY Reg. Number: HE 217340 | EU VAT Number: CY10217340J

Visa
Mastercard
PayPal
Bitcoin
Tether
Ethereum
Litecoin
Wise
Revolut
Wire Transfer