I installed OSGeo4W. I have no other Python version on my computer. I can import osgeo. But when I try to import qgis.core I am getting the error:

>>> import qgis.core
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named qgis.core

What could be the reason for that?

  • Are you running this in QGIS python console? – underdark Mar 8 '13 at 6:25
  • No, I am not. I am running it in the command line. Can I use QGIS only in the QIS python console? – ustroetz Mar 8 '13 at 17:30

This error means that the qgis.core module is not in your PYTHONPATH.

See the instructions in the PyQGIS cookbook on how to use the QGIS API from a python script running outside of QGIS:


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.