How to Install And Check Python Version In Windows, Mac, & Linux

How to Install And Check Python Version in Windows Mac LinuxHow to Install And Check Python Version in Windows Mac Linux

Python is a popular, cross-platform programming language that developers used to create applications, write automation scripts, configure servers, and much more. It enables them to do more with less code (as compared to some other programming languages) and has a syntax similar to the English language.

Like all other software, the Python language also receives updates, incrementing its version number. Today, we are going to show you how you can identify which Python version is installed on your PC so you know whether you are using the latest version or an older one.

Python Version Nomenclature

The Python programming language’s version is in 3 parts. It is 3 numbers divided by 2 decimal points, like this:

X.Y.Z

The “X” is the major version, “Y” is the minor version, and “Z” is the micro version.

Usually, the major releases are not compatible with one another. For example, Python version 3.11.0 would not be compatible with 2.7.3. However, the minor releases are generally compatible with each other. For example, 3.11.0 would be compatible with 3.9.2.

The micro versions are mostly patches and updates.

Now let us continue to see how to install Python on your PC.

How to Install Python

Install Python on Windows

Unlike Linux, installing Python on a Windows computer is easier since it comes in an executable .EXE bundle, and you do not need to use the terminal for it.

Follow these steps to install Python on your Windows PC:

  1. Open the Python downloads page using any web browser and click Download Python X.Y.Z. This will download the latest available version of Python.

    Download Python
    Download Python

    Alternatively, you can also download Python from Microsoft Store.

  2. Once downloaded, run the package to install Python.

  3. You will now see the installation wizard. Click Install Now.

    Install Python
    Install Python
  4. Python installation will now begin. When the process completes, click Close.

    Close Python installation wizard
    Close Python installation wizard

You have successfully installed the Python programming language on your computer.

If you wish to uninstall it in the future, here are the steps:

  1. Open the Programs and Features applet by typing in appwiz.cpl in the Run Command box.

    appwiz
    Open Programs and Features applet
  2. Right-click on “Python” followed by the version number and then click Uninstall from the context menu.

    Uninstall Python
    Uninstall Python
  3. You will then see the uninstallation wizard running and removing Python from your PC. When it is completed, Python will have been removed. Close the wizard.

    Close uninstallation wizard
    Close uninstallation wizard

Install Python on macOS

Installing Python on Mac is very much similar to Windows since it also comes in an executable .PKG file. But before you do, check if it is already installed since most macOS devices have it preinstalled.

If it is not available, follow these steps to install it:

  1. Open the Python downloads page for macOS using any web browser and click Latest Python X Release – Python X.Y.Z. This will download the latest available version of Python.

    Download Python for macOS
    Download Python for macOS
  2. When downloaded, run the package to begin the installation and follow through with the on-screen instructions.

  3. When installed, close the wizard, and Python would have been installed successfully.

Install Python on Linux

Like macOS, most Linux distros also have Python preinstalled. However, if you don’t, follow these steps to install it:

  1. In the terminal, run the following cmdlet:

    sudo apt-get install python3.11
  2. This will now install the specified version of Python. To upgrade to the latest available run, run the following cmdlets one after the other:

    sudo apt-get update
    sudo apt-get upgrade

You will now have installed the latest version of Python on your Linux machine.

How to Check Installed Python Version

Check Python Version on Windows

There are different ways you can check the version number of Python installed on a Windows PC.

From Start Menu

The simplest way to determine the Python version installed on your computer is from the Start menu.

Simply search for “Python” in the Start menu and the application will pop up along with the version number, as in this picture:

Search for Python
Search for Python to see the version

However, this method does not show the micro version number, therefore may not be ideal for many.

From the Python App

Another method to find the Python version is through the Python terminal itself. All you need to do is open the app and the terminal will display the complete version.

Open the Python terminal either by searching for it in the search box in the taskbar, through the Start menu, or by typing in python in the Run Command box.

Python
Python

You will then see the full version of Python at the top of the terminal.

Check Python version from terminal
Check the Python version from the app

From Windows PowerShell

You can also check the installed Python version through Windows PowerShell. Simply run the following cmdlet in an elevated PowerShell instance:

python --version

You shall now see the version of Python installed on your PC.

Check Python version from Windows PowerShell
Check Python version from Windows PowerShell

When running the cmdlet given above, the chances are that you may run into an error stating the following:

Python was not found; run without arguments to install from Microsoft Store or disable this shortcut from Settings > Manage App Execution Aliases
Python version error in PowerShell
Python version error in PowerShell

This error occurs because Python does not automatically add itself to the environmental variables. However, you can add them yourself using these steps:

  1. Navigate to the following directory using File Explorer:

    C:\Users\[Username]\AppData\Local\Programs\Python\Python[XYZ]

    Replace [Username] with the user account name you are using, and [XYZ] is Python’s version number which will vary according to the version that you have installed.

    Moreover, the AppData directory is hidden, so you will either need to view hidden directories or enter the path for it manually in the navigation bar.

    This path will be needed in the steps ahead. We navigate to this path using Explorer since it includes some variables, and we will need the exact path.

  2. Now, we must add the environmental variables. To do that, open the System Properties applet by typing in sysdm.cpl in the Run Command box.

    sysdm
    Open System Properties
  3. Switch to the Advanced tab and then click Environmental Variables.

    Open Environment Variables settings
    Open Environment Variables settings
  4. From the Environmental Variables window, click Path under the System Variables section and then click Edit.

    Edit Path system variable
    Edit Path system variable
  5. From the Edit window, click New, and then enter the following path from File Explorer:

    C:\Users\[Username]\AppData\Local\Programs\Python\Python[XYZ]
    Enter first environmental variable
    Enter first environmental variable
  6. Now click New again, and now enter the following variable:

    C:\Users\[Username]\AppData\Local\Programs\Python\Python[XYZ]\Scripts
    Enter second environmental variable
    Enter second environmental variable
  7. Now click Ok on all the open windows to save the settings and close the windows.

After performing these steps, you should now be able to check the Python version from Windows PowerShell.

Check Python Version on macOS/Linux

Checking the installed Python version on macOS or a Linux machine is very much similar to Windows. All you need to do is run the following cmdlet in the terminal:

python --version

You should now get the complete version number for Python.

See List of Installed Python Versions

Users can install more than one Python version on their computers, provided the major build is different. In this case, you can obtain a list of the versions that are installed on your computer.

Just run the following cmdlet to see the version numbers of all Pythons installed on your computer in an elevated PowerShell instance:

py --list
List all Python versions
List all Python versions

Closing Words

Python developers can know which version is running on their computers using the given guide above. However, this information is only useful if you are looking for a specific version, having a specific feature or function. You can view the changelog history of all Python 3 versions from here and Python 2 versions from here.

If you liked this post, Share it on:

Get Updates in Your Inbox

Sign up for the regular updates and be the first to know about the latest tech information

Subhan Zafar is an established IT professional with interests in Windows and Server infrastructure testing and research, and is currently working with Itechtics as a research consultant. He has studied Electrical Engineering and is also certified by Huawei (HCNA & HCNP Routing and Switching).

Leave the first comment