[Gdal-dev] Building on Windows with Python 2.5

Howard Butler hobu.inc at gmail.com
Wed Oct 3 14:04:39 EDT 2007


To build the next-gen Python bindings for GDAL (assuming the current  
trunk here) you need to have the following settings in your nmake.opt:
- SWIG must be set to the location of your swig install.  1.3.31 is  
required
- PY_DIR must be set so it can find python.exe

Additionally, these items should be done:
- GDAL must already be made by doing 'nmake /f makefile.vc' in the  
root of the GDAL source directory
- Numpy should already be installed in the python you are using with  
PY_DIR
- Having setuptools installed might be advantageous, but not required

After these conditions are met, cd into ./swig and issue 'nmake /f  
makefile.vc python'. This command will regenerate the bindings with  
swig and build the module.  After it is built, you can cd into ./swig/ 
python and issue 'python setup.py bdist_wininst' to have it build a  
windows installer that will end up in ./swig/python/dist, or 'python  
setup.py bdist' to have it build a zip distribution.

Howard

On Oct 3, 2007, at 9:59 AM, Rob McCulley wrote:

> Hi All,
>
>
>
> I’m trying to make the migration to Python version 2.5.  In the  
> past, I’ve been lazy, and just the MS4W version of the GDAL python  
> bindings.  They are compiled for Python 2.4 though, so I’ve been  
> trying to build GDAL and the Python bindings for version 2.5  
> without much success.  I’m working with the GDAL version 1.4.2  
> source code and compiling with MSVC2003 (7.1).
>
>
>
> The build runs just fine, as far as I can see.  There don’t appear  
> to be any errors.  The bin directory is populated with all the  
> utility programs, various python scripts, the data directory, the  
> html directory and the pymod directory.  As far as I can see the  
> utility programs run fine.  When I copy the contents of the pymod  
> directory over to the site-packages directory in Python25 and try  
> and import gdal I get the following error:
>
>
>
> Traceback (most recent call last):
>
>   File "<interactive input>", line 1, in <module>
>
>   File "C:\Python25\lib\site-packages\gdal.py", line 191, in <module>
>
>     import _gdal
>
> ImportError: No module named _gdal
>
>
>
> As a test, I compiled gdal against Python 2.4, and everything  
> worked fine.  The python modules imported without error.  Any ideas  
> on what to do to get it working with 2.5?  Is this a problem with  
> having both 2.4 and 2.5 installed on the system?
>
>
>
> Alternatively, this seems like as good a time as any to move over  
> to the next generation bindings.  How does one go about building  
> the NG bindings with MSVC2003?
>
>
>
> Thanks,
>
> Rob McCulley
>
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/gdal-dev





More information about the Gdal-dev mailing list