![how-to-check-the-version-of-python-eng](http://www.meccanismocomplesso.org/wp-content/uploads/2016/11/How-to-check-the-version-of-Python-eng.jpg)
From the Python console
The current version is available in the sys module, more precisely in the sys.version variable.
>>> import sys
With Python 2.x
>>> print sys.version
2.7.8 |Anaconda 2.1.0 (64-bit)| (default, Jul 2 2014, 15:12:11) [MSC v.1500 64 bit (AMD64)]
With Python 3.x
>>> print (sys.version)
3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)]
For further processing:
>>> (a,b,c,d,e) = sys.version_info
>>> a
3
>>> b
4
>>> c
3
Or you can use the hexversion
>>> sys.hexversion
50594800
From the command line
From the command line (note the capital ‘V’):
$ python -V
Assert minimal version requirements in a Python code
If you need to ensure a script runs with a minimal version requirement of the Python interpreter add this to your code:
>>> assert sys.version_info >=(2,5)
This compares major and minor version information.[:]