Hello, Jurgen,
In Windows QGIS.bat, it has also got the same content.
@echo offcall "%~dp0\o4w_env.bat"@echo offpath 
%OSGEO4W_ROOT%\apps\qgis\bin;%PATH%set 
QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgisset GDAL_FILENAME_IS_UTF8=YESrem 
Set VSI cache to be used as buffer, see #6448set VSI_CACHE=TRUEset 
VSI_CACHE_SIZE=1000000set 
QT_PLUGIN_PATH=%OSGEO4W_ROOT%\apps\qgis\qtplugins;%OSGEO4W_ROOT%\apps\qt4\pluginsstart
 "QGIS" /B "%OSGEO4W_ROOT%"\bin\qgis-bin.exe %*
But, I do not know how to use this information in Python, to set runtime path.
Regards.
David

 

    On Wednesday, 4 May 2016, 12:50, Jürgen E. Fischer <[email protected]> wrote:
 

 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     
                   
_______________________________________________
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

  
_______________________________________________
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

Reply via email to