3

I'm able to run PyQGIS on my Mac (OSX 10.10.3) through the Python (2.7) console and through execution of Python files through my terminal. In order to do so, I added the following to my bash_profile:

export PATH=$PATH:/Library/Frameworks/GDAL.framework/Programs/
export PYTHONPATH=$PYTHONPATH:/Applications/QGIS.app/Contents/Resources/python/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/Applications/QGIS.app/Contents/MacOS/lib/:/Applications/QGIS.app/Contents/Frameworks/

However, when running the same scripts in PyCharm, I get the following package not found errors:

ImportError: No module named qgis.core
ImportError: No module named PyQt4.QtCore
ImportError: No module named PyQt4.QtGui

In PyCharm settings, I've tried adding the following Environment Variables to Build, Execution, Deployment > Console > Python Console:

PATH - /Library/Frameworks/GDAL.framework/Programs/
PYTHONPATH - /Applications/QGIS.app/Contents/Resources/python/
LD_LIBRARY_PATH - /Applications/QGIS.app/Contents/MacOS/lib/:/Applications/QGIS.app/Contents/Frameworks/

...but to no avail. I've tried playing around with adding/removing semicolons and $VARS but no joy.

This problem is quite vexing as I'm able to import the packages without problem in PyCharm's Python console. I'm using a virtualenv that is setup within my PyCharm.

Your Answer

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

Browse other questions tagged or ask your own question.