Search code examples
pythonmacosimportmacportsgdal

Gdal will not import after several installs (Mac OSX)


Using Macports,

I've tried to install: gdal, py27gdal, and gdal-grass. All so I can import gdal into python 2.7.2.

Neither have been successful.

When I type:

port list installed

I see the installed modules:

gdal-grass                     @1.4.3          gis/gdal-grass   
gdbm                           @1.8.3          databases/gdbm    
py27-gdal                      @1.7.1          python/py27-gdal

And when I run python to import the module:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named gdal

What am I doing wrong?


Solution

  • Are you using the MacPorts python2.7? Try launching Python this way:

    /opt/local/bin/python2.7