How To Check The Python Version?

Check Python Version

Sometimes you might require to check the current version that is being run by your Python Scripts. This article is a quick guide to check your python version that your scripts are executed on. I’ve demonstrated two version checks, one is the human-readable version and the other is the hexadecimal version.

Getting Human-Readable (Simple Numeric) Version of Python

All you need to find out the simple numerical version of python installed on your system is to run the python command with capital V as an option. The exact command is written below.

python -V

Simply run this command in the command prompt or any of the other python execution terminal window and you’ll find the numerical human-readable current running python version printed on your screen. The screenshot for the demonstration of the same is given below.

Python Version Check

Detailed Version Details (Additional Information & Hexadecimal Version)

To get some insights about the current running python version on your machine, you can use the sys module which comes pre-installed with Python. All you need to do is first import the sys module and use the different properties such as sys.version, sys.version_info and sys.hexversion to get details of the version as per your requirement.

Run the following commands to get the further version details.

import sys




I’ve executed all of these commands in the command prompt after entering into python command-line by simply typing python first into the command line and then the command as specified above.

Python Version Details Hexa Version

You can clearly see in the screenshot the different properties of sys give different and more specific version details.

Note. There may be several other ways to find out the installed python version on your system as well. You can share any other way to find out the Python version in the comments section if you know one.

One more way we found is using the python_version() function included in the platform python module from stdlib.

from platform import python_version


The following screenshot is the command-line execution representation for the same.

Finding Python Version STDLIB

I hope as a beginner, you found this article useful. If so, do share it with others who might get benefits from this article as well. Feel free to ask any kind of questions related to this article in the comments section.

Also, don’t forget to Subscribe to WTMatter!

Subscribe To WTMatter!

Receive updates of our latest articles via email. Enter your email address below to get started.

Leave a Reply

Your email address will not be published. Required fields are marked *