> I guess my question actually boils down to: how can I specify in the > configure phase, which python to use for the bindings? E.g. I have both > 2 and 3 on my system, and 3 is the default, but I want gdal to build and > install the bindings for 2. Could I specify > --with-python=/usr/bin/python2 when running configure? (Or even better, > build and install it for both pythons in one run...)
No, AFAIK you can't specify the name of the python executable. --with-python just accept yes or no. Don't bother with --with-python in configure, it doesn't do much, apart from automating the process. So just try : cd swig/python /usr/bin/python2 setup.py build /usr/bin/python2 setup.py install /usr/bin/python[3] setup.py build /usr/bin/python[3] setup.py install and you'll have the bindings built and installed for the 2 versions > > Thanks, > Vincent. > > > 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 > >>> [email protected] > >>> http://lists.osgeo.org/mailman/listinfo/gdal-dev > >> > >> _______________________________________________ > >> gdal-dev mailing list > >> [email protected] > >> http://lists.osgeo.org/mailman/listinfo/gdal-dev > > _______________________________________________ > gdal-dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/gdal-dev _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
