Skip to main content
deleted 23 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

I tried for long and found the following points are important

  1. Always use the OSGEO4W-Shell to execute an osgeo-program, don't use cmd.exe directly. (The shell executes all batch files in %OSGEO4W_ROOT%/etc/ini where a lot of environment variables are set)

  2. To start python with full qgis support, so you can run standalone python qgis apps, use the following environment settings:

    SET QGIS_PREFIX_PATH=%OSGEO4W_ROOT:=/%/apps/qgis SET PYTHONPATH=%OSGEO4W_ROOT%\apps\qgis\python SET PYTHONHOME=%OSGEO4W_ROOT%\apps\Python27 SET PATH=%PATH%;%OSGEO4W_ROOT%\apps\Python27\Scripts;%OSGEO4W_ROOT%\apps\qgis\bin

most of it you have already set, but mine is slightly different, as you can see. Plus the batch-files called by the osgeo4w-shell fill the %PATH% correctly. Try it, I hope, it helps.

I tried for long and found the following points are important

  1. Always use the OSGEO4W-Shell to execute an osgeo-program, don't use cmd.exe directly. (The shell executes all batch files in %OSGEO4W_ROOT%/etc/ini where a lot of environment variables are set)

  2. To start python with full qgis support, so you can run standalone python qgis apps, use the following environment settings:

    SET QGIS_PREFIX_PATH=%OSGEO4W_ROOT:=/%/apps/qgis SET PYTHONPATH=%OSGEO4W_ROOT%\apps\qgis\python SET PYTHONHOME=%OSGEO4W_ROOT%\apps\Python27 SET PATH=%PATH%;%OSGEO4W_ROOT%\apps\Python27\Scripts;%OSGEO4W_ROOT%\apps\qgis\bin

most of it you have already set, but mine is slightly different, as you can see. Plus the batch-files called by the osgeo4w-shell fill the %PATH% correctly. Try it, I hope, it helps.

I tried for long and found the following points are important

  1. Always use the OSGEO4W-Shell to execute an osgeo-program, don't use cmd.exe directly. (The shell executes all batch files in %OSGEO4W_ROOT%/etc/ini where a lot of environment variables are set)

  2. To start python with full qgis support, so you can run standalone python qgis apps, use the following environment settings:

    SET QGIS_PREFIX_PATH=%OSGEO4W_ROOT:=/%/apps/qgis SET PYTHONPATH=%OSGEO4W_ROOT%\apps\qgis\python SET PYTHONHOME=%OSGEO4W_ROOT%\apps\Python27 SET PATH=%PATH%;%OSGEO4W_ROOT%\apps\Python27\Scripts;%OSGEO4W_ROOT%\apps\qgis\bin

most of it you have already set, but mine is slightly different, as you can see. Plus the batch-files called by the osgeo4w-shell fill the %PATH% correctly.

Source Link

I tried for long and found the following points are important

  1. Always use the OSGEO4W-Shell to execute an osgeo-program, don't use cmd.exe directly. (The shell executes all batch files in %OSGEO4W_ROOT%/etc/ini where a lot of environment variables are set)

  2. To start python with full qgis support, so you can run standalone python qgis apps, use the following environment settings:

    SET QGIS_PREFIX_PATH=%OSGEO4W_ROOT:=/%/apps/qgis SET PYTHONPATH=%OSGEO4W_ROOT%\apps\qgis\python SET PYTHONHOME=%OSGEO4W_ROOT%\apps\Python27 SET PATH=%PATH%;%OSGEO4W_ROOT%\apps\Python27\Scripts;%OSGEO4W_ROOT%\apps\qgis\bin

most of it you have already set, but mine is slightly different, as you can see. Plus the batch-files called by the osgeo4w-shell fill the %PATH% correctly. Try it, I hope, it helps.