How to update Python in Windows, Mac, and Linux

As you all know, Python is the new trend in the world of computer programming. Working with the updated versions of python is more fun because it comes with more libraries for advanced programming.

Let’s get to know how to update python in Windows, Mac, and Linux, if you are already working with Python and want an upgraded version

Requirement for Updating Python

There are two basic conditions for updating python in your operating system.

  • If you have to switch between two major versions of python i.e. version 2 or version 3 then they will be installed in different directories on your PC.
  • If you have to switch between two minor versions i.e. the latest version of series 2 or the latest version of series 3, just install them one over the other.
  • Download the latest version from their website and run it on your PC. The files of the previous version will be removed and python is updated automatically.
  • Make sure you are running the installer as an Admin, Or you might get an installer error.

You can choose the desired version after installation using the following command 

py - (your required version)

How to update Python in Windows 10

Python can be updated in Windows in multiple ways. Let’s discuss all of them below.

Video tutorial for windows 7, 8, 10.

Using python windows installer

Let’s get to know about the way to update python using the python windows installer.

  • Go to Downloads and click View the full list of downloads
  • Select your desired version.
  • Click to open this executable file.
  • Select both given options before installation; Install the Python for all users and add the Python next to the path.
  • Select Customize Installation to customize the setting
  • Select your desired Optional Features and click NEXT. Select td/tk and IDLE to install Python IDLE which works as an IDE for Python code.
  • Select your desired Advanced Features. Then click Browse to select the required path to save it on your PC. Then click Install.
  • The installation process will start. 
  • After installation, the python is set up on your PC. Click CLOSE to end the process.
  • Open a command prompt and use either of the following commands to check the version of python on your PC.
>> python --version
Python 3.8.2
>> python -V
Python 3.8.2
>> py --version
Python 3.8.2
>> py -V
Python 3.8.2

Using Chocolatey Software

Chocolatey is a software for Windows that automates the installation of any software for you. It wraps installers, executables, zips, and scripts into compiled packages. 

First of all, install the chocolatey software from www.chocholatey.org according to the given commands. Then follow the given steps to update python in windows.

  • Open Windows Power Shell or Command Prompt. Write choco list python.
  • All the packages of python will be listed below.
command to see all choco python packages
  • If your system has 64-bit windows then the latest version will be installed on it. Otherwise, if it is a 32-bit system, the latest version starting with the python-x86_32 command will be installed.
install Python package using Chocolatey
  • Beware of installing any package having a Possibly broken flag in front of it.
  • Now write choco install python. The most recent version of python will get installed on your system.
  • If your want to install python 2 then give the command choco install python2 and the latest version of python 2 will be updated on your system.
  • If you are asked to run any script then write A so that all the next scripts will run automatically.
  • The latest version has been updated on your PC
  • Now restart the PowerShell and give the following command to check the version installed on your PC.

python --version

How to update Python in MAC

There are two ways to update python on MAC. Both are explained in detail below. Follow the steps carefully to omit any error you may encounter.

Video tutorial to install/upgrade Python on Mac

Using Python Installer

The process to upgrade to python’s latest version using the python installer is as follows:

  • Go to Downloads and click View the full list of downloads
  • Select your desired version.
  • Select the MAC installer.
  • Select the downloaded file.
  • Open the downloaded file.
  • The installer is opened. Read the introduction and click CONTINUE.
  • Read the important information about python and click CONTINUE.
  • Read the history and license and click CONTINUE.
  • Click AGREE to accept the terms and conditions and continue the installation.
  • Select a destination to save the file and click CONTINUE.
  • Click INSTALL to start the installation of the upgraded version.
  • Enter the password to confirm.
  • Installation is getting prepared.
  • Finally, the upgraded version is installed.

To check whether the latest version is successfully installed on your MAC or not, open the terminal on your PC and write the given command and you will get the version of python which is recently installed on your PC.

python --version

Using Homebrew

Homebrew is a software package management system that helps in the installation of software on macOS.

To upgrade python by using homebrew, you first have to install the homebrew software on your MAC from the website https://brew.sh/ according to the given commands. Now you can proceed to upgrade python using homebrew.

  • Open Terminal on your MAC.
  • Write a command brew doctor to check if everything is working right in homebrew software and then we can proceed.
  • Now if you want to upgrade to the latest version of python 3 then write brew search python3 otherwise, if you want to upgrade the latest version of python 2 then write a command brew search python2.
  • After the searching process, now write brew install python3 for the latest version of python 3 otherwise write brew install python2 for the latest version of python 2.
  • Hence the latest version of python 2 or 3 is upgraded on your MAC. You can check it by writing the following command on the terminal.

python --version

How to update python on Linux

Linux is a large family of Unix operating systems. The way to update python in each of them is different. We will discuss the pattern to update python in some of the very famous Linux systems here.  To install Python on Chromebooks, check this out.

Updating python in Kali Linux

To update python in Kali Linux, you have to follow the following steps.

  • Go to Downloads and click View the full list of downloads
  • Select your desired version and click Download.
  • The file will be downloaded as a zipped file in the Downloads folder of your system.
  • Extract the file in the same folder.
  • Run the given command to update your terminal.

apt-get update

  • Now, run the following commands one by one.

cd Downloads

cd Python-3.9.1

./configure

./configure --enable-optimizations

make

make install

  • Now, your latest version of python is installed on your system.
  • You can check it by the given command.

python --version

Updating python in Ubuntu using PPA

PPA is the abbreviation for Personal Package Archives. These are the software repositories designed for Ubuntu users to help them download different third-party software easily. To update python in Ubuntu by using PPA you have to follow the following commands.

  • Open terminal.
  • Run the given commands step by step.

sudo apt install software-properties-common

Write Y when asked for any permission.

sudo add-apt-repository ppa:deadsnakes/ppa

sudo apt update

sudo apt install python 3.9

  • Now, your latest version of python is installed for Ubuntu.
  • You can check it by the given command.

python --version

Wrap Up

Wrapping it up, the different ways to update the python to your desired latest version in Windows, MAC, and Linux systems are explained above in detail. These procedures will surely work for your need. Hope you will find these ways helpful. Don’t forget to share your precious thoughts with us.