我在运行OS X 10.9.5的Mac上安装了底图版本1.0.7-5和pyproj版本1.9.3-1的Enthought Canopy版本1.5.2730。当我尝试导入底图时,我收到以下错误消息。
from mpl_toolkits.basemap import Basemap
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-4-5e6824321d57> in <module>()
----> 1 from mpl_toolkits.basemap import Basemap
/Users/wiltbemj/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py in <module>()
28 from matplotlib.lines import Line2D
29 from matplotlib.transforms import Bbox
---> 30 from mpl_toolkits.basemap import pyproj
31 from mpl_toolkits.axes_grid1 import make_axes_locatable
32 from matplotlib.image import imread
ImportError: cannot import name pyproj
如果我尝试直接导入pyproj,我会收到以下错误消息
ImportError Traceback (most recent call last)
<ipython-input-1-0cc08144b629> in <module>()
----> 1 from mpl_toolkits.basemap import pyproj
/Users/wiltbemj/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py in <module>()
35 import numpy as np
36 import numpy.ma as ma
---> 37 import _geoslib
38 import functools
39
ImportError: dlopen(/Users/wiltbemj/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-package /_geoslib.so, 2): Library not loaded: @rpath/lib/libgeos_c.1.dylib
Referenced from: /Users/wiltbemj/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/_geoslib.so
Reason: image not found
我尝试卸载并重新安装软件包但没有成功。缺少的dylib位于/ opt / local / lib目录中的机器上。不确定它是路径问题还是更复杂的东西。非常感谢有关如何开始调试问题的任何提示。
答案 0 :(得分:0)
IIUC,这是由于一些以前由basemap提供的库,现在由geos提供,通过更新底图不适当地删除了。
要解决此问题,请打开Canopy Terminal(从Canopy工具菜单中)并输入:
enpkg --remove geos
enpkg geos