[Gdal-dev] Python Support on MacOSX

Sean Gillies sgillies at frii.com
Sat Jun 4 10:54:00 EDT 2005


On Jun 3, 2005, at 10:44 PM, BABA Yoshihiko wrote:

> Hi
>
> I am not good at python and want help from Pythonists. This is for
> GDAL-1.2.6 and Python 2.3 (not System's) on MacOSX 10.3.9.
>
> I'm trying to make gdal package for Fink on MacOSX with Python
> support. When I did as follows, it built and installed everything:
>
>     perl -pi.bak -e 's,^PYTHON_INCLUDES =
> \@PYTHON_INCLUDES\@,PYTHON_INCLUDES = -I%p/include/python2.3
> -I%p/include/python2.3/Numeric,' GDALmake.opt.in
>     perl -pi.bak -e 's,^PYTHON_LIBS = \@PYTHON_LIBS\@,PYTHON_LIBS =
> -L/sw/lib/python2.3/config -lpython2.3,' GDALmake.opt.in
>     perl -pi.bak -e 's,^PYTHON_CFLAGS = \@PYTHON_CFLAGS\@
> \@NUMPY_FLAG\@,PYTHON_CFLAGS =  -I%p/include/python2.3
> -I%p/include/python2.3/Numeric,' GDALmake.opt.in
>     perl -pi.bak -e 's,^PYTHON = \@PYTHON\@,PYTHON =
> %p/bin/python2.3,' GDALmake.opt.in
>     perl -pi.bak -e 's,^PY_LD_SHARED = \@PY_LD_SHARED\@,PY_LD_SHARED =
> ,' GDALmake.opt.in
>     perl -pi.bak -e 's,^INST_PYMOD      =
> \@pymoddir\@,INST_PYMOD      = %i/lib/python2.3/site-packages,'
> GDALmake.opt.in
>
> Note: %p means Fink's root (/sw in most cases) and %i means install 
> director.
>
> As you see, I tried to link to Fink version of Python, not System's.
> Then I tried to use GDAL in Python and got an error as:
>
> YahooBB220041001026:~ baba$ /sw/bin/python
> Python 2.3.4 (#1, Mar 27 2005, 05:51:42)
> [GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import gdal
> Fatal Python error: Interpreter not initialized (version mismatch?)
> Abort trap
> YahooBB220041001026:~ baba$
>
> Does it get confused with System's python or what? Any idea?
>
>
> Thank you
>

BABA,

Don't hack the GDALmake.opt.in file. Everything can be accomplished 
with proper use of the GDAL configure script. To specify a particular 
python, do something like this

   $ ./configure [OPTIONS]... PYTHON=/sw/bin/python

Sean

--
Sean Gillies
sgillies at frii dot com
http://zcologia.com




More information about the Gdal-dev mailing list