[Gdal-dev] GDAL scripting with Python 2.5 (on windows)

Matt Wilkie matt.wilkie at gov.yk.ca
Tue Oct 20 12:49:21 EDT 2009

Thanks for the effbot pointer Markus. I've been thinking for ahwile now 
that I'd like to register the gdal python as the system default for 2.5 
but didn't have a recipe and was mapping out a plan to work out some 
sort of regedit batch file trickery. Now there is a much cleaner route :)


matt wilkie
Geomatics Analyst
Information Management and Technology
Yukon Department of Environment
10 Burns Road * Whitehorse, Yukon * Y1A 4Y9
867-667-8133 Tel * 867-393-7003 Fax

Markus Reinhold wrote:
>  Hej,
>  Aleksey Naumov-2 wrote:
> > My problem is being able to do scripting with GDAL using Python 2.5
> > (this version is important because of integration/compatibility
> > with a number of other packages, mainly IPython), and I need to be
> > able to do it on Windows. I attempted a few approaches, but could
> > not figure out how to get all the pieces to work together:
> >
>  first things first: It is definitely possible to use the GDAL Python
>  1.6 bindings on Python 2.5 under Windows, cause
>  http://www.box.net/shared/pp82vkdp8j that's what I'm running over
>  here  as well. Now I can't give a detailed installation instruction
>  as it was a piecewise work, but following is what I can recall: 1)
>  I'm using the installer from OSGeo4W to setup my geospatial toolbox.
>  Using the advanced installation process the packages I'm considering
>  important are python, gdal (or gdal16), gdal-python (or
>  gdal16-python), python-numpy and python-win32. The latter two I'm not
>  sure how essential they really are, I have them installed in any way.
>  2) To use version 1.6 of GDAL it is necessary to a) install the
>  corresponding packages (see above) and b) switch to the 1.6
>  environment using gdal16.bat under osgeo4w\bin\gdal16.bat. However
>  this works for the OSGeo4W shell only and is not applied system-wide.
>  See
>  http://n2.nabble.com/Python-1-6-bindings-under-Windows-td3337254.html
>  my conversation with the list on this matter  a few weeks ago. I've
>  adjusted the %PYTHONPATH% to
>  *C:\OSGeo4W\apps\gdal-16\pymod;C:\OSGeo4W\apps\Python25\Lib* on my
>  system to use gdal16 system-wide. 3) A minor thing. When importing
>  the bindings I use *from osgeo import gdal* instead of *import gdal*.
>  However that does not seem to be your problem as the latter
>  alternative should give you a deprecation warning but not refuse to
>  work altogether. 4) The Python version of OSGeo4W is the default one
>  on my system. It works fine, I only had a few problems when
>  installing third-party extensions that need correct registry settings
>  for the installation. Have a look a
>  http://effbot.org/zone/python-register.htm this script  (and
>  especially the last comment) on how to fix this problem. That's all
>  what I can think of now. Maybe there's something you can look at to
>  find a solution for your problems. Regards, Markus
>  -----

More information about the gdal-dev mailing list