Check the Python Version

The quickest way to check the Python version is to run this command in the command line:

Another, and quicker way (note the capital v):

Both commands will work on all popular systems: Windows, Linux, and Mac.

More information

You can add another capital v, if you want more information, like the Python version, and release date.

It will also display whether you use the 32-bit or 64-bit versions.

Python versions

There are two major Python versions: Python 2 and Python 3 that are not fully compatible.

If both versions are installed on the machine you can check for Python 2 using this command:

or

If you want to check the python3 version, use this command:

Check the Python version inside the code

To check the version of the Python interpreter inside the script you have to import the sys module first, and then display the Python version.

The print function will display this result:

3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)]

You can also display the system version info:

Result:

sys.version_info(major=3, minor=7, micro=2, releaselevel='final', serial=0)