How can I discover the Python version in QGIS?

Looks like in QGIS v3.0, python v3 will be implemented:

Help us to plan for QGIS 3.0

Updating Python 2.7 to Python 3: Currently we bundle in Python 2.7 in our windows installers and require 2.7 on other platforms where we do not co-bundle Python with QGIS. Python 3 is the latest version of python and is recommended by the Python project. Python 2 is slightly incompatible with Python 3 (in much the same way as QGIS 2 -> QGIS 3 will be incompatible). The python developers have made Python 3 largely backwards compatible to Python 2, but the compatibility in the opposite direction is not as good.

Here is the syntax you may run in the python console in QGIS to verify version:

import sys
print sys.version_info

Alongside sys.version_info, as mentioned above, you can use

import sys
sys.version

sys.version_info will give this kind of output (this comes from my copy of QGIS 2.18.1):

>>> import sys

>>> sys.version_info

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

sys.version will give the version number, alongside the compiler used:

>>> import sys

>>> sys.version

'2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]'

Another way to know what version of python you are using can be to run the following command on the python console that has QGIS:

from platform import python_version
print(python_version())

enter image description here

Tags:

Qgis

Pyqgis