14

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.

4 Answers 4

17

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
  • 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. Commented Dec 20, 2016 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. Commented Dec 20, 2016 at 13:55
12

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)]'
6

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

2

Since QGIS 3.20 you can use the Help > About to see the Python version.

example

2
  • Unfortunately, I can not see anything related to Python version under Help > About in my QGIS 3.18. I see: QGIS version, Compiled against Qt, Compiled against GDAL/OGR, Compiled against GEOS, Compiled against SQLite, PostgreSQL Client Version, QWT Version, Compiled against PROJ, OS Version, Active python plugins, QGIS code revision, Running against Qt, Running against GDAL/OGR, Running against GEOS, Running against SQLite, SpatiaLite Version, QScintilla2 Version, Running against PROJ.
    – Taras
    Commented Jul 14, 2021 at 13:23
  • It's in 3.20 github.com/qgis/QGIS/commit/… Commented Jul 14, 2021 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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