How to Check Python Version in Linux, Mac, & Windows – phoenixNAP

Check python version


What version of Python do I have installed?

Python is a popular programming language. Like many other programming languages, there can be several different versions organized by release date. Certain applications may require a specific version of Python.

In this tutorial, you will learn how to check the Python version on Windows, Linux, or macOS systems.


Accessing a command-line window/terminal

: Linux: Ctrl-Alt-T,

  • Ctrl-Alt-F2
  • Windows: Win+R > powershell type > Enter/OK
  • MacOS: Finder > Applications > Utilities > Terminal

There are different versions of Python, but the two most popular are Python 2.7.x and Python 3.7.x. The x stands for the revision level and could change as new versions come out.

When looking at the version number, there are usually three digits to read:

the major version the minor version


  1. micro version
  2. While

  3. major
  4. versions


not fully supported, minor versions usually are. Version 3.6.1 must be compatible with 3.7.1, for example. The last digit indicates the latest patches and updates.

Python 2.7 and 3.7 are different applications. Software that is written in one version will often not work correctly in another version. When using Python, it is essential to know which version an application requires and which version it has.

Python 2 will stop releasing updates and security patches after 2020. They extended the deadline due to the large number of developers using Python 2.7. Python 3 includes a 2-to-3 utility that helps translate code from Python 2 to Python 3.

How to check Python version on Linux Most modern Linux distributions come with Python pre-installed. To check the installed version,

open a terminal window and enter the following:

python -version How to check Python



Windows Most out-of-the-box Windows installations don’t

come with Python preinstalled


However, it’s always a good idea to check it out.

Open Windows PowerShell and type

the following

: python -version

If you have Python installed, it will report the version number


Alternatively, use the Windows Search function to see which version of Python you have:

Press the Windows key to start a search, and then type Python. The system will return the matching results. Most likely, a match will show something similar

to: Python 3.7 application (32-bit)


, Python 2.7 application (32-bit)

This defines which major and minor revision (3.x or 2.x) you are using.


to check Python version on MacOS

If you use a MacOS, check the Python version by entering the following command in the terminal:

python -version

The system will report the version


Checking a system with multiple versions of Python

Python2 and Python3 are different programs. Many programs are upgraded from the previous version to the latest version. However, Python 2.7.x installations can be run separately from Python version 3.7.x on the same system.

Python 3 is not fully backward compatible.

To check if Python


: python -version

To check the Python 3 software version:

python3 -version

Most systems differentiate Python 2 as python and Python 3 as python3. If you don’t have Python 2, your system can use the python command instead of python3.


to check the Python version in the script

When writing an application, it is useful for the software to check the Python version before it runs to avoid crashes and incompatibilities


Use the following code snippet to check the correct version of

Python: import sys if not sys.version_info.major == 3 and sys.version_info.minor >= 6: print(“Python 3.6 or higher is required.”) print(“You are using Python {}.{}.”. format(sys.version_info.major, sys.version_info.minor)) sys.exit(1)

When this script runs, it will test whether Python 3.6 is installed on your system. Otherwise, it will send a notification and display the current version of Python.


You should now have a solid understanding of how to check the version of Python installed on several different operating systems. Python is a powerful programming language, so it’s important to understand its different versions.

If you want to learn how to upgrade Python to

a newer version on Wondows, macOs, and Linux, check out our article on how to upgrade Python to 3.9.

Contact US