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_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:

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
  • 2
    Givent that QGIS 3.0 will be released in the next months, it's probably still worth considering to directly start learning python 3. – Matthias Kuhn Dec 20 '16 at 13:46
  • Thanks artwork21 and Matthias Kuhn! Your information were very helpful. My actual version is 2.7.5, but I´m gonna start learning Python 3 and wait the next version. – Kleber Barcelar Dec 20 '16 at 13:55

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

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.