How to Update the Python Version: Step-by-Step Guide Install Python and Upgrade Python Version

Posted on

How to Update the Python Version: Step-by-Step Guide Install Python and Upgrade Python Version

Python is a popular high-level and open-source programming language. It supports object-oriented programming, making it suitable for developing software, websites, and machine-learning applications. Python is compatible with various operating systems like Linux, Windows, and macOS.

New Python releases include significant updates, addressing bugs and introducing new features. Minor upgrades are also released regularly, further enhancing Python’s capabilities.

Therefore, it’s important to know how to update your Python version to take advantage of the latest functionality and features. If you’re using an older version, you might need to upgrade PIP, the package installer, to update Python.

This tutorial provides a comprehensive, step-by-step guide on how to update your Python version after installing Python on Windows, Linux, and macOS.

How to Update the Python Version on Windows?

If you’re using Windows, you can easily check your Python version and upgrade it to the latest version through the command line. The following methods are available to update Python on Windows:

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

Let’s explore each method in detail.

How to Check the Python Version in Windows?

Before updating, it’s crucial to check your current Python version. To do this on Windows, press “Windows + R”, type “cmd”, and press “Enter.”

how to update the python version: step-by-step guide install python and upgrade python version

A command line window will appear. Execute the following command to check your Python version:

> python --version

The installed Python version will be displayed, as shown below:

how to update the python version: step-by-step guide install python and upgrade python version

In the image above, Python version “3.11.0” is installed. If Python isn’t installed, you’ll see this output:

how to update the python version: step-by-step guide install python and upgrade python version

If this is the case, you’ll need to install Python. The following sections cover how to install Python on Windows and Linux.

Method 1: Update the Python Version Using Python Installer

To upgrade using the Python Installer, follow these steps:

Step 1: Download Python from the Official Website

Download the latest Python version from the official website. for Windows. To download a specific version, visit the Python releases section.

Click the “Download Python 3.11.5” button.

how to update the python version: step-by-step guide install python and upgrade python version

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

The installer will be downloaded to your system’s Downloads folder automatically.

Step 2: Run Python Installer

Once downloaded, double-click the installer to start the installation wizard.

Step 3: Install Python

Select “Install Now” to install Python on your Windows system and add python.exe to PATH.

how to update the python version: step-by-step guide install python and upgrade python version

The installation process will take a few seconds.

how to update the python version: step-by-step guide install python and upgrade python version

After the installation is complete, click the “Close” button.

Step 4: Verify Python Installation

Verify the installation using the “python -V” command:

how to update the python version: step-by-step guide install python and upgrade python version

This confirms the latest Python version is installed. You can test the Python installation with the following command:

> python.exe

how to update the python version: step-by-step guide install python and upgrade python version

You can also upgrade Python on macOS using these steps, downloading the appropriate installer for macOS.

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

Windows Chocolatey Package Manager is a command-line tool for installing applications on Windows. This section describes how to install or upgrade Python with Chocolatey:

Step 1: Launch PowerShell as Administrator

Run Windows PowerShell as administrator.

Step 2: Install Chocolatey on Windows

To install Python or update, you need Chocolatey. Install it using this 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

Verify the installation with the “choco” command:

how to update the python version: step-by-step guide install python and upgrade python version

The installed Chocolatey version (e.g., “Chocolatey v1.2.1”) will be displayed.

Step 4: Upgrade the Python Version with Chocolatey

Update Python with Chocolatey using this command:

> choco upgrade python -y

how to update the python version: step-by-step guide install python and upgrade python version

This will install the latest Python packages.

how to update the python version: step-by-step guide install python and upgrade python version

After the upgrade, check the Python version:

how to update the python version: step-by-step guide install python and upgrade python version

How to Update the Python Version on Linux Distribution?

Many command-line users prefer Linux distributions. Using Linux commands, you can easily install and update Python. If you are a Linux user, follow the steps below to upgrade Python on your Linux server:

Step 1: Check the Python Version on Linux:

First, check the currently installed Python version to see if an update is necessary. In modern Linux distributions, Python3 is often pre-installed.

You can check the Python version using the “Python –version” command. Open the “Terminal” (“Ctrl+Alt+t”) and type:

$ python3 -V

Or

$ python3 --version

how to update the python version: step-by-step guide install python and upgrade python version

Step 2: Add PPA Repository

To install Python on Ubuntu 22.04, add the “deadsnakes” PPA repository. This allows you to install the latest Python version. Use this command:

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

how to update the python version: step-by-step guide install python and upgrade python version

After adding the repository, update the system’s apt repositories using the “apt update” command:

$ sudo apt update

Step 3: Install Python on Ubuntu

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

$ sudo apt install python3.11

how to update the python version: step-by-step guide install python and upgrade python version

Step 4: Check the Python Version

Again, check the version to verify:

$ python3.11 --version

how to update the python version: step-by-step guide install python and upgrade python version

The latest Python version is now installed. You can further upgrade it using the apt package manager:

$ sudo apt upgrade python3

Conclusion

This guide demonstrated how to install and update Python on Windows and Linux. Following these steps allows you to access the latest Python features.

Furthermore, you can upgrade Python on Windows and Linux VPS servers.
If you encounter any issues, please leave your feedback in the comments.

Leave a Reply

Your email address will not be published. Required fields are marked *