Get gdal development libraries:
$ sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable
$ sudo apt-get update
$ sudo apt-get install libgdal-dev
Create and activate a virtual environment:
$ virtualenv gdalenv
$ source gdal/bin/activate
Download GDAL:
(gdalenv) $ pip install --no-install GDAL
Specify where the headers are:
(gdalenv) $ cd /path/to/gdalenv/build/GDAL
(gdalenv) $ python setup.py build_ext --include-dirs=/usr/include/gdal/
Install GDAL:
(gdalenv) $ pip install --no-download GDAL
Done.
For the error bellow, i solved adding GDAL lib (
gdal-config --libs
) and include (gdal-config --cflags
) files path:--global-option="-I/usr/include/gdal -L/usr/local/lib -lgdal"