How to check the version of Python on Windows, Mac and Linux

0
361

[ad_1]

monticello / Shutterstock.com

To check which version of Python is installed on your Windows, Mac, or Linux computer, all you have to do is run a single command. We’ll show you how to do this and what to do if you have multiple versions of Python installed.

RELATED: What is Python?

How to read Python versions

A version of Python consists of three values: a major version, a minor version, and a micro version. An example of a Python version is:

Python 3.10.4

In the previous version, 3 refers to the major version of Python. The second digit, which is 10refers to the minor version of Python, and the last digit, 4indicates the micro version of Python.

Major versions of Python are generally not compatible with each other, but minor versions are.

Check Python version on Windows

On your Windows PC where you installed Python, use the PC’s built-in PowerShell utility to check the version number.

To get started, open your “Start” menu and search for “Windows PowerShell” (without quotes). Then click on the utility in the search results.

Select "Windows PowerShell."

When PowerShell opens, type the following command and press Enter:

python --version

Access the version of Python in PowerShell.

PowerShell will display the version of Python installed on your PC.

View the version of Python in PowerShell.

And that is.

RELATED: How to install Python on Windows

See the version of Python on Mac

On your Mac, you’ll use the pre-installed Terminal app to see your version of Python.

Launch Terminal by first opening Spotlight (using the shortcut Command + Space) and then finding and clicking “Terminal”.

In the Terminal window, type the following command and press Enter:

python --version

Your current version of Python will be displayed.

RELATED: 16 Terminal Commands Every Mac User Should Know

Checking the version of Python on Linux

To check the version of Python installed on Linux, open a Terminal window (you can often use the shortcut Ctrl + Alt + T), type the following command, and press Enter:

python --version

The terminal will generate your current version of Python.

RELATED: How to start a terminal window in Ubuntu Linux

What if your computer has multiple versions of Python installed?

You could have multiple versions of Python installed on your computer at the same time. This is because some applications use the newer Python 3, while others still rely on Python 2.7 to run. In this case, to find the version of each Python instance, you will use the following commands.

To check the version of Python 2.7, use this command:

python --version

For Python 3, use the following command:

python3 --version

And everything is ready.


Wondering what version of PowerShell you’re running on your PC? It is equally to find that information.

RELATED: How to check the version of PowerShell in Windows 10

[ad_2]