2

I'm trying to set the PYTHONPATH in order to be able to load the qgis classes in a python console (not the QGIS Python one).

I followed some resources I've found (PYQGIS Cookbook, and others) but I get still the same error message:

>>> import qgis.core
ImportError: No module named qgis.core

I'm pretty sure the problem is that I have a compiled version of QGIS and of course the PATHs suggested are different.

The folder of my QGIS is:

/home/user/QGIS-master

I tried to add the following to the .bashrc file in order to have the PATH but nothing changed (still the error of above):

export PYTHONPATH=/home/user/QGIS-master/python/

Someone has an idea of which is the correct PATH I have to export?

1 Answer 1

4

The folder for the PYTHONPATH must be the compiled one and not the source one. Your build path should be something like /home/user/QGIS-master/<builddir>/output/. I am guessing you are running from build your QGIS version so you just export the environment var like:

export PYTHONPATH=/home/user/QGIS-master/<builddir>/output/python/

maybe it also could be necessary to set LD_LIBRARY_PATH (as mentioned in PyQGIS Cookbook).

export LD_LIBRARY_PATH=/home/user/QGIS-master/<builddir>/output/lib/

0

Your Answer

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

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