我是使用 python 在地图上制作/绘图的新手,一直在尝试按照这篇博文生成世界地图 (http://sciblogs.co.nz/seeing-data/2011/08/12/plotting-geographic-带有python的世界地图上的数据/)。在这里遇到了一些事情:
安装 Basemap(用于在地理投影上绘制数据的 Matplotlib 扩展)。
from mpl_toolkits.basemap import Basemap Traceback (most recent call last): File "geos_demo.py", line 1, in <module> from mpl_toolkits.basemap import Basemap ImportError: No module named mpl_toolkits.basemap
安装Shapely,但出现如下错误[1]:
然后我进入 geos.py 文件并将 geos.dll 的所有引用更改为 geos_c.dll,按照此处链接的建议:http: //osgeo-org.1560.n6.nabble.com/osgeo4w-258- python-shapely-python-2-7-2-td4336816.html 的问题
但是,会发生相同的错误 [1]。
我正在使用 Python 2.7.1 和 Mac OS 10.7.4。如果我可以提供更多信息,请告诉我,非常感谢社区提供的任何指导!谢谢!
[1]
from shapely.geometry import Point
Traceback (most recent call last): File "<stdin>", line 1, in <module>
File "/Users/Desktop/python/ENV/lib/python2.7/site-packages/shapely/geometry/__init__.py", line 4, in <module>
from geo import box, shape, asShape, mapping
File "/Users/Desktop/python/ENV/lib/python2.7/site-packages/shapely/geometry/geo.py", line 5, in <module>
from point import Point, asPoint
File "/Users/Desktop/python/ENV/lib/python2.7/site-packages/shapely/geometry/point.py", line 7, in <module>
from shapely.coords import required
File "/Users/Desktop/python/ENV/lib/python2.7/site-packages/shapely/coords.py", line 8, in <module>
from shapely.geos import lgeos
File "/Users/Desktop/python/ENV/lib/python2.7/site-packages/shapely/geos.py", line 59, in <module>
_lgeos = load_dll('geos_c', fallbacks=alt_paths)
File "/Users/Desktop/python/ENV/lib/python2.7/site-packages/shapely/geos.py", line 44, in load_dll
libname, fallbacks or []))
OSError: Could not find library geos_c or load any of its variants ['/Library/Frameworks/GEOS.framework/Versions/Current/GEOS', '/opt/local/lib/libgeos_c.dylib']