[gdal-dev] How to build python bindings on windows?

Even Rouault even.rouault at mines-paris.org
Sun Jan 8 16:03:26 EST 2012


Le dimanche 08 janvier 2012 21:44:58, Joaquim Luis a écrit :
> Hi,
> 
> I made my first attempt to build the python bindings on Windows  and
> like others have complained before ... nothing happened
> I did set PYDIR  and  PY_INST_DIR but at the end no errors nor anything
> else python related.
> Next I went to swig\python and did
> python.exe setup.py build
> which resulted in
> 
> ...
> copying osgeo\osr.py -> build\lib.win32-2.6\osgeo
> copying osgeo\__init__.py -> build\lib.win32-2.6\osgeo
> running build_ext
> building 'osgeo._gdal' extension
> error: Unable to find vcvarsall.bat
> 
> why the hell is it looking for vcvarsall.bat (the VS batch that sets
> necessary env variables)? And who is doing that? I grepped for vcvarsall
> and nothing showed up.

Generally, to build Python extensions on Widnows, you need to use the same 
version of MSVC that was used to compile your Python binary. For python 2.6, I 
believe that the provided binaries are compiled with MSVC 2008 for example. 
See http://bugs.python.org/issue5235

If you have not that version, then you can probably hack distutils script to 
convince them to use whatever version of MSVC you have. Or you can rebuild 
python with the msvc version you have.

I'm not sure what Tamas did with its SDKs ( http://vbkto.dyndns.org/sdk/ : 
seems to be down just now ) where he manages to provide the Python bindings on 
various MSVC versions.

> 
> Thanks
> 
> Joaquim
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list