Feb 15, 2012

How to install GDAL, OGR and Shapely on Mac OS X Lion 10.7

First, install the GDAL Complete framework (a packaged binary build that includes GDAL/OGR, GEOS, PROJ.4).

Download the GDAL Python package from PyPI. Untar it, cd to the new directory and execute the following:

CFLAGS=`/Library/Frameworks/GDAL.framework/Versions/1.8/Programs/gdal-config --cflags` LDFLAGS=`/Library/Frameworks/GDAL.framework/Versions/1.8/Programs/gdal-config --libs` python setup.py install

Now download the Shapely Python package from PyPI, untar, cd, then:

LDFLAGS=`/Library/Frameworks/GEOS.framework/Versions/3/unix/bin/geos-config --libs` CFLAGS=`/Library/Frameworks/GEOS.framework/Versions/3/unix/bin/geos-config --cflags` python setup.py install

Confirm that it worked by issuing:

python -c 'import osgeo; print osgeo.__version__'

Should print 1.8.1, and:

python -c 'import shapely.speedups; print shapely.speedups.available'

Should print True.

link blog Subscribe via RSS.