2

I am developing a standalone app using qgis librarys and run the python inside qgis. I import the librarys with no errors but I have one last error: ImportError: no module named site. I define the paths like this:

 'PYTHONHOME': 'C:\OSGeo4W64\apps\Python27',
 'PYTHONPATH': 'C:\OSGeo4W64\apps\Python27\Lib',
 'PATH': 'C:\OSGeo4W64\apps\qgis\bin;C:\OSGeo4W64\bin;C:\OSGeo4W64\apps\Python27'

I see that site.py is in 'C:\OSGeo4W64\apps\Python27\Lib', so I still have the error. The app doesn't read the correct site.py?

5

Try this:

SET OSGEO4W_ROOT=C:\OSGeo4W
SET QGISNAME=qgis
SET QGIS=%OSGEO4W_ROOT%\apps\%QGISNAME%
set QGIS_PREFIX_PATH=%QGIS%

CALL %OSGEO4W_ROOT%\bin\o4w_env.bat

: Python Setup
set PATH=%OSGEO4W_ROOT%\bin;%QGIS%\bin;%PATH%
SET PYTHONHOME=%OSGEO4W_ROOT%\apps\Python27
set PYTHONPATH=%QGIS%\python

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.