[QGIS-Developer] Eclipse config for QGIS API

Clemens Raffler clemens.raffler at gmail.com
Mon Jan 15 12:23:41 PST 2018


Hi Anita,

after some headaches I managed to enable full code-completion in 
eclipse/pydev for pyqgis and PyQt5 for the current development version. 
I hope sharing my setup (similar to yours on OSGeo4W64) with you may help:

-) First I configured my PYTHONHOME and PYTHONPATH environment variables 
in the Windows configuration:

PYTHONHOME="C:\OSGeo4W64\apps\Python36\python.exe"
PYTHONPATH="C:\OSGeo4W64\bin;C:\OSGe‌​o4W64\apps\qgis\‌​bin;%Path%"

-) In the windows Path variable I entered following paths to all the libs:

C:\OSGeo4W64\bin
C:\OSGeo4W64\apps\Qt5\bin
C:\OSGeo4W64\apps\qgis-dev\bin
C:\OSGeo4W64\apps\qgis-dev\python
C:\OSGeo4W64\apps\‌​qgis-dev\python\plug‌​ins
C:\OSGeo4W64\apps\‌​qgis-dev\python\plug‌​ins\processing

With this system-side setup you can start eclipse even without .bat file 
and finish the configuration with the following steps:
-) Window>Preferences>Pydev>Interpreters>Python Interpreter
-) Add your Python interpreter at C:\OSGeo4W64\apps\Python36\python.exe
-) Configure the interpreters environment variables at the tab 
"Environment" and there again set (yet) another variable named PATH with 
the following values:

PATH="C:\OSGeo4W64\bin;C:\OSGeo4W64\apps\qgis-dev\bin;C:\OSGeo4W64\apps\Qt5\bin;C:\OSGeo4W64\apps\qgis-dev\python\plugins\processing"

-) Then enter two new "Forced Builtins" under the respective tab. Enter 
"qgis" and "PyQt5".
-) Finish by applying all your changes.

The code-completion should now work - maybe reload eclipse by using File 
 > Restart (sometimes simple closing doesn't help...).
I hope there are no typos in this guide, however I wish you good luck 
with the setup!

Regards,
Clemens



More information about the QGIS-Developer mailing list