How to Update the Python Version

Python is the most popular high-level and open-source programming language. It offers object-oriented programming features that help in developing software, websites, and cutting-edge machine-learning applications. Moreover, Python can be installed on different operations such as Linux, Windows and macOS. 

Also, all new Python releases come with major updates, which not only address critical bugs but also introduce exciting new features. In addition, Python consistently rolls out minor upgrades every few months, continually enhancing its capabilities.  

Thus, in this ever-evolving landscape, understanding how to update your Python version is a crucial skill, as it ensures that you stay on the receiving edge of functionality and features. However, if you are using an earlier Python version, you may need to upgrade PIP, the command line interface for managing PyPI program installation, to update the Python version.  

In this tutorial, we will provide a comprehensive, step-by-step guide on how to update your Python version after installing Python on Windows, Linux, and macOS operating systems.

How to Update the Python Version on Windows?

If you are using the Windows operating system, you can easily check your Python version via the command line and upgrade Python to its latest version. In this section, we will discuss how to update the Python version on Windows. Namely, you can update the Python version on Windows using two different methods listed below:

  1. Using the Python Installer
  2. Via the Windows Chocolatey Package Manager

So, let’s discuss how to update your Python version using the above-mentioned methods in detail.

How to Check the Python Version in Windows?

It’s essential to check the current Python version running on your computer before updating Python. To check the Python version on Windows, press the “Windows + R” keys, type “cmd” in the text box, and hit “Enter.”

how to update the python version

The command line interface will pop up on the desktop. Once it does, execute the following command to check the current Python version:

> python --version

The installed Python version should display on the command prompt, as shown in the screenshot below:

how to update the python version

As you can see in the image above, Python version “3.11.0” is installed on this system. If Python is not installed on your system, you will see the following output on the command prompt:

how to update the python version

In this case, you need to install Python on your system. And don’t worry; in the sections below, we will also cover how to install Python on Windows and Linux if it is not already installed on your system. 

Method 1: Update the Python Version Using Python Installer

To upgrade the Python version using the Python Installer, you need to perform the following steps:

Step 1: Download Python from Official Website

Download the latest Python version from its official website. If you want to download another version, visit the Python releases section for Windows and choose your preferred Python version. 

Click on the “Download Python 3.11.5” button to download it. 

how to update the python version

Source: https://www.python.org/downloads/


You will notice that the Python Installer will automatically start to download Python on your system and save it in your system’s Downloads folder.

Step 2: Run Python Installer

Once the Python Installer is downloaded on your system, double-click on the Installer to begin the installation wizard.

Step 3: Install Python

Select “Install Now” to install Python on your Windows system, and don’t forget to add python.exe to PATH.

how to update the python version

Be patient; the installation will take a few seconds to complete on your system.

how to update the python version


After completing the Python installation, click on the “Close” button to exit the installation wizard. 

Step 4: Verify Python Installation

Once Python is installed, verify whether the latest Python version is installed on your system or not. Check the installed version using the following “python -V” command:

how to update the python version

As you can see, the latest Python version is installed on this system. You can test the Python installation using the below command:

> python.exe

how to update the python version

Using the steps mentioned above, you can also upgrade the Python version on macOS by downloading the Python Installer on your system.

Method 2: How to Update the Python Version Using Windows Chocolatey Package Manager?

Windows Chocolatey Package Manager is a command line tool that allows users to install new applications or software on Windows OS. In this section, we will install Python or upgrade the current Python version with Chocolatey using the following steps:

Step 1: Launch PowerShell as Administrator

Run the Windows PowerShell as administrator on your system. 

Step 2: Install Chocolatey on Windows

To install Python or update the Python version, you need to install “Windows Chocolatey Package Manager.” To install Chocolatey on Windows, run the following command:

> Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

Step 3: Verify Chocolatey Installation

Once you install Chocolatey, verify its installation by executing the “choco” command:

how to update the python version

The installed Chocolatey version should be displayed on the PowerShell Window. As you can see in the above image, “Chocolatey v1.2.1” is installed on this system.

Step 4: Upgrade the Python Version with Chocolatey

This step allows you to update the Python version with Chocolatey using the following command:

> choco upgrade python -y

how to update the python version

The command above will install the latest Python packages on your Windows system.

how to update the python version

Once the upgrade process is completed, check the Python version:

how to update the python version

How to Update the Python Version on Linux Distribution?

Most command-line users prefer to use Linux distributions on their systems. Using different Linux commands, you can easily install Python and update its version. Therefore, if you are a Linux user, follow the below-listed steps to upgrade the Python version on your Linux server:

Step 1: Check the Python Version on Linux:

First, it is recommended that you check the Python version that is currently installed. You can easily decide whether an update is required or not. In modern Linux distributions, Python3 is pre-installed as part of the system. 

However, you can check the Python version on a Linux distribution using the “Python --version” command. Open the “Terminal” using “Ctrl+Alt+t” and type the following command to check the Python version:

$ python3 -V

Or 

$ python3 --version

how to update the python version

Step 2: Add PPA Repository

To install Python on the Ubuntu 22.04 system, you must add the “deadsnakes” PPA repository to your system. This repository allows you to install the latest Python version for your Ubuntu distribution. You can add this repository by using the below command:

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

how to update the python version

After adding this repository, update the Ubuntu system apt repositories by executing the “apt-update” command:

$ sudo apt update

Step 3: Install Python on Ubuntu 

For this guide, we will get the latest Python version, “3.11.5.” To install Python 3.11 on Ubuntu 22.04, execute the following command:

$ sudo apt install python3.11

how to update the python version

Step 4: Check the Python Version

Again, check the Python version to verify the installation:

$ python3.11 --version

how to update the python version

You will notice that the latest Python version is installed on your system. Further, you can upgrade the Python version using the apt package manager:

$ sudo apt upgrade python3

Conclusion

In this guide, we demonstrated how to install and update the Python version on Windows and Linux distributions. By following the steps detailed above, you'll gain access to the latest Python features that come with the updated versions. 

Moreover, by using this guide, you can upgrade the Python version of Windows and Linux VPS servers. If you find any difficulty, leave your feedback in the comments.