Windows OS

How to Update Python in Windows


Python is a popular, high-level, all-purpose programming language used to create and design software and websites and perform automated tasks. Additionally, it is also utilized in many machine learning applications as well as data transformation and analysis. Each new release of Python comes with new features and bug fixes. Therefore, You must know how to update Python on your system.

In this tutorial, we will illustrate the procedures used to update Python in Windows:

Method 1: Update Python in Windows Using Python Installer

To update Python in Windows using the Python installer, follow the below-mentioned steps carefully.

Step 1: Check Python Version

Firstly, check the current Python version using Command Prompt:

>python -V

The given output indicates that currently, Python version “3.9.13” is installed on our system:

Step 2: Download Python Installer

Navigate to the below-provided link and download Python’s latest installer:

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

Step 3: Execute Python Installer

Go to the “Downloads” directory. Execute the Python installer by double clicking on the downloaded file:

Step 4: Install Python

Mark the highlighted checkboxes and click on the “Install Now” script:

As you can see, we have successfully installed the latest Python version:

Step 5: Check Python Version

Again, check out the Python Version:

>python -V

We have successfully updated to Python Version “3.10.5” on Windows:

Let’s check out the second approach to update Python on Windows.

Method 2: Update Python in Windows Using Chocolatey Package Manager

Chocolatey package manager can be utilized to update Python in Windows. Follow the below-given steps to update Python with the help of PowerShell.

Step 1: Open Windows PowerShell

Press “Window+X” to open the Power User menu, and run “Windows PowerShell(Admin)”:

Step 2: Install Chocolatey

Firstly, install the Chocolatey package manager by utilizing the below provided command:

> Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Let’s move forward toward the next step.

Step 3: Confirm Chocolatey Installation

Verify Chocolatey package manager installation by executing the “choco” command:

> choco

From the below-given output, you can see that we have successfully installed “Chocolatey v1.1.0” on Windows:

Step 4: Update Python

Next, run the “choco upgrade” command to upgrade Python:

> choco upgrade python -y

Note: If Python is not installed using the Chocolatey package, then the “upgrade” command will install Python first.

Step 5: Verify Python Version

Verify Python is upgraded by checking out its version:

> python -V

As you can see, our Windows system now has the updated Python “3.10.5” version:

We have demonstrated the methods to update Python in Windows.

Conclusion

Given the multiple methods of installing and updating python its important to stick with one method and make sure its working. You might think its easier than it is to have a working and up to date python on Windows, but it does require some knowledge and attention to details to make sure you have installed it correctly and keep it up to date. As well as how to access python in your path from a prompt or an IDE.

About the author

Rafia Zafar

I am graduated in computer science. I am a junior technical author here and passionate about Programming and learning new technologies. I have worked in JAVA, HTML 5, CSS3, Bootstrap, and PHP.