Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have both ArcGIS 10.1 and QGIS 1.8 installed and both include Python 2.7 in slightly different setups and in different folders (c:\Python27\ArcGIS10.1\ and c:\Program Files (x86)\Quantum GIS Lisboa\apps\Python27).

It is only ArcGIS which include python.exe, while it is really QGIS I would like to start experimenting with for some scripting, but preferably just running my scripts from the command console.

Are there any recommendations on how to do this smartest? I'm thinking of settings environment variables etc.

I am new on both QGIS and python.

share|improve this question
up vote 7 down vote accepted

While you can do it with the standalone installed copy of QGIS I would highly recommend installing QGIS and QGIS-dev using the OSGeo4W installer. OSGeo is easier to update and lets you get the latest stuff.

That will install Python into C:\OSGeo4W\app\Python27 and let you run Python from the OSGeo4W shell. python.exe lives in C:\OSGeo4W\bin.

I have some examples of QGIS stuff at

Use the following batch file as a bootstrap to your python file:

set PATH=%OSGEO4W_ROOT%\bin;%OSGEO4W_ROOT%\apps\qgis-dev\bin;%PATH%
set PYTHONPATH=%OSGEO4W_ROOT%\apps\qgis-dev\python
set QGIS_PREFIX_PATH=%OSGEO4W_ROOT%\apps\qgis-dev\
share|improve this answer
I have installed OSGeo4W instead of QGIS alone and have created this batch files: SET OSGEO4W_ROOT=C:\OSGeo4W SET PYTHONHOME=%OSGEO4W_ROOT%\apps\Python27 Set PYTHONPATH=%OSGEO4W_ROOT%\apps\qgis\python;%PYTHONPATH% Set PATH=%OSGEO4W_ROOT%\apps\qgis\bin;%PATH% Set QGIS_PREFIX_PATH=%OSGEO4W_ROOT%\apps\qgis\ %OSGEO4W_ROOT%\bin\python The test file only includes one line:</br>from qgis.core import *</br>But it fails with the error message that the DLL could not be loaded. Not saying which DLL it is. – Uffe Kousgaard May 24 '13 at 12:12
Adding line breaks failed completely... – Uffe Kousgaard May 24 '13 at 12:18
@UffeKousgaard see update – Nathan W May 24 '13 at 12:47
OK, thanks, I have gotten as far as opening a SHP file now. Just wondering, why all I get from this code is a "feature ID 0": no Error messages. – Uffe Kousgaard May 24 '13 at 13:57
ArcGIS ships with it's own version of Python mine lives in C:\Python27\ArcGIS10.1\python.exe. You can't really have them both setup at the same time else you get conflicts. – Nathan W May 29 '13 at 21:08

I just posted a question/answer to this that may be helpful. This is my take on how to utilize multiple python installations on the same computer.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.