Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install Latest Python Version in Ubuntu - DesignLinux

Nov 15 2022
designlinux 0 Comments

Python is the fastest-growing major general-purpose programming language. There are a number of reasons attributed to this, such as its readability and flexibility, ease to learn and use, reliability, and efficiency as well.

There are two major Python versions being used – 2 and 3 (the present and future of Python); the former will see no new major releases, and the latter is under active development and has already seen a lot of stable releases over the last few years. The latest stable release of Python 3 is version 3.11.

On newer Ubuntu releases, Python 3.10 or Python 3.8 is pre-installed, which is not the case for older Ubuntu versions.

In this article, we will explain how to install the latest Python 3.11 version on all Ubuntu releases via the apt package manager using deadsnakes PPA.

To install the latest version of Python from sources in all major Linux distributions, check out this guide: How to Install Latest Python from Source in Linux

Install Python 3.11 on Ubuntu

To install the latest Python 3.11 version, you can use “deadsnakes” team PPA which contains more recent Python versions packaged for Ubuntu.

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

If you want to install a specific Python version or multiple versions of Python in your Ubuntu system, you can simply run the following command with the Python version number as shown.

$ sudo apt install python3.10
$ sudo apt install python3.9
$ sudo apt install python3.8
$ sudo apt install python3.7
$ sudo apt install python3.6

To view a list of all Python binaries installed on your system, run the following ls command.

$ ls -l /usr/bin/python*
List Python Binaries
lrwxrwxrwx 1 root root      10 Apr 22  2022 /usr/bin/python3 -> python3.10
-rwxr-xr-x 1 root root 5901416 Apr  2  2022 /usr/bin/python3.10
-rwxr-xr-x 1 root root 6705016 Oct 24 15:56 /usr/bin/python3.11
-rwxr-xr-x 1 root root     960 Dec 23  2020 /usr/bin/python3-futurize
-rwxr-xr-x 1 root root     964 Dec 23  2020 /usr/bin/python3-pasteurize

From the output in the screenshot above, the default Python version on the test system is 3.10, you can also check the Python version using the following command.

$ python -V

Python 3.10.4

To use Python 11, invoke the following command.

$ python3.11 
Access Python Shell
Python 3.11.0 (main, Oct 24 2022, 19:56:13) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print ("TecMint #1 Linux Blog");
TecMint #1 Linux Blog
>>> quit()

To exit the Python interpreter, type the following command and press Enter.

quit()
OR
exit()

Set Default Python Version in Ubuntu

If you’ve installed multiple versions of Python in your Ubuntu system, and you want to set only one version as default, then you need to perform some additional steps as shown.

$ python3 --version
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
$ sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2
$ sudo update-alternatives --config python3
$ python3 --version
Set Default Python Version in Ubuntu
Set Default Python Version in Ubuntu

That’s all! In this short article, we have explained how to install Python 3.11 in Ubuntu via the apt package manager. If you have questions, use the comment form below to reach us.

Related

Tags: Ubuntu Tips

How to Synchronize Time with Chrony NTP in Linux

Prev Post

How to Install Docker on Ubuntu 22.04

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 1
  • 489
  • 612,668

DesignLinux.com © All rights reserved

Go to mobile version