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

Markus Reinhold markus.reinhold at uni-jena.de
Mon Oct 19 23:01:04 EDT 2009


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
*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.


Dipl.-Kartograph Markus Reinhold

Chair of Geoinformatics, Geohydrology and Modeling
Friedrich-Schiller-University Jena
Löbdergraben 32
D - 07743 Jena

Phone.: (+49)(0)3641 / 9 488 65
E-Mail: markus.reinhold at uni-jena.de
View this message in context: http://n2.nabble.com/GDAL-scripting-with-Python-2-5-on-windows-tp3851288p3856494.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.

More information about the gdal-dev mailing list