You've successfully subscribed to StackInk
Great! Next, complete checkout for full access to StackInk
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.

How to Install the latest Python version on Ubuntu 23.04

Among the most popular high-level programming languages, Python is widely used for developing websites, performing scientific calculations, analyzing data, and constructing artificial intelligence systems.

Follow the instructions below to install Python on Ubuntu 23.04.

Step 1:

Always update your system before installing any new software to ensure that you have the latest security updates and software versions. Run the following commands to update your system:

sudo apt update
sudo apt upgrade

Step 2:

It is a good idea to check whether Python is already installed on your computer before installing Python. You can accomplish this by opening the terminal and executing the following command:

python3 -V

The version number of Python will be displayed if Python is installed. An error message will appear if Python is not installed.

Step 3:

Using the following command, you can install Python on Ubuntu 22.04:

sudo apt install python3

The following command will help you to install the latest version of Python on your system.

Step 4:

You can verify the installation by running the following command:

python3 -V

Python's version number should appear, which indicates that the installation was successful.

Step 5:

Python 2 is the default Python version in Ubuntu 22.04. Make Python 3 the default Python version. Run the following command to make Python 3 the default version:

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1

Run the following command to confirm that Python 3 is the default Python version:

python --version

The version number should show Python 3, which indicates that Python 3 is now the default Python version.