Where can I discover the Python version installed in QGIS 2.18.1?
I would like to buy a book to introduce me at Python interface. I´ve found one that addresses the version 3.3 of Python.
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)]'
Looks like in QGIS v3.0, python v3 will be implemented:
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