开发者

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?


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

/opt/local/bin/python2.7


I'm not 100% sure if this solves your problem, but gdal is in the osgeo namespace. So you should try importing gdal like this:

from osgeo import gdal

The gdal namespace itself is deprecated.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜