Hi David, On Wed, 04. May 2016 at 11:43:24 +0000, David Shi wrote: > How to set python search path for standalone script? > > I am writing a standalone script, but it can not import qgis.core and other > processing. modules.
In OSGeo4W there is a batch file python-qgis.bat you can pass your script to: @echo off call "%~dp0\o4w_env.bat" @echo off path %OSGEO4W_ROOT%\apps\qgis\bin;%PATH% set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis set GDAL_FILENAME_IS_UTF8=YES rem Set VSI cache to be used as buffer, see #6448 set VSI_CACHE=TRUE set VSI_CACHE_SIZE=1000000 set QT_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\qgis\qtplugins;%OSGEO4W_ROOT%\apps\qt4\plugins set PYTHONPATH=%OSGEO4W_ROOT%\apps\qgis\python;%PYTHONPATH% "%OSGEO4W_ROOT%"\bin\python.exe %* PYTHONPATH and QGIS_PREFIX_PATH are most important. Jürgen -- Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31 Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50 Software Engineer D-26506 Norden http://www.norbit.de QGIS release manager (PSC) Germany IRC: jef on FreeNode
pgpie8lN_1CnB.pgp
Description: PGP signature
_______________________________________________ Qgis-user mailing list [email protected] List info: http://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user
