[gdal-dev] gdal swig python's setup.py not python3 compatible

Even Rouault even.rouault at mines-paris.org
Wed Dec 29 12:06:25 EST 2010


Vincent,

you didn't mention which GDAL version you use. Since GDAL 1.7.0, the Python 
bindings work with both python 2.X and 3.X. But I see that the autoconf check  
for python isn't python3 ready indeed. So you can ignore the configure errors 
and just cd swig/python and build the buindings from there directly (make 
build; make install)

Best regards,

Even

Le mercredi 29 décembre 2010 14:27:09, Vincent Schut a écrit :
> Oops, wrong conclusion. Seems more complicated than I thought, as there
> are some python checks in configure that use python...
> 
> Lets change this into a question:
> 
> as I have both python2 and python3, with /usr/bin/python linking to
> python3 (so python3 is the default), and gdal's python extension seems
> to be not python3 compatible (at least the build/install method), what
> would be the prefered way to have gdal's configure/make/make install use
> python2 for everything? E.g. use /usr/bin/python2 as executable, and the
> python2 site-packages dir for installing.
> 
> As lots of my own scripts and other extensions I use are still not
> really python3-ready, I don't mind using python2 myself, but I'd like to
> keep the system default to python3 because I don't want to mess to much
> with my system's defaults (I tend to forget stuff I change manually, etc.)
> 
> Tia,
> Vincent.
> 
> On 12/29/2010 02:19 PM, Vincent Schut wrote:
> > Hi,
> > 
> > some time ago, Arch linux made the rather bold decision to have python3
> > as system python default, of course with a /usr/bin/python2 alternative
> > sitting next to it. However, as the /usr/bin/python link is pointing to
> > /usr/bin/python3, gdal's swig python module's setup.py is being called
> > with python3, and appears to be not python3 compatible:
> > 
> > checking for python bindings... checking for python... python
> > checking for location of Python Makefiles... File "<string>", line 3
> > print sys.prefix
> > ^
> > SyntaxError: invalid syntax
> > File "<string>", line 3
> > print sys.prefix
> > ^
> > SyntaxError: invalid syntax
> > File "<string>", line 3
> > print sys.version[:3]
> > ^
> > SyntaxError: invalid syntax
> > found
> > checking where to install Python modules... /lib/python/site-packages
> > enabled
> > checking for python setuptools... File "<string>", line 3
> > print 1
> > ^
> > SyntaxError: invalid syntax
> > not found
> > configure: checking whether we should include rasdaman support...
> > rasdaman support not requested.
> > configure: creating ./config.status
> > config.status: creating GDALmake.opt
> > 
> > Imho the easiest way to fix this would be to have a '#!/usr/bin/python2'
> > as first line in setup.py; I suppose every distro has also a
> > /usr/bin/python2 executable/link, even if there is not yet a python3 one.
> > 
> > Regards,
> > Vincent.
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
> 
> _______________________________________________
> 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