问题描述
我通过遵循Cartopy官方网站上提供的示例,尝试与Cartopy一起玩。 他们都正常工作,但第一个
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
ax = plt.axes(projection=ccrs.PlateCarree())
ax.coastlines()
plt.show()
所有的行都可以正常工作,但是一旦我运行plt.show()命令,我就会收到以下错误消息:
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1539, in __call__
return self.func(*args)
File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 278, in resize
self.show()
File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 349, in draw
FigureCanvasAgg.draw(self)
File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_agg.py", line 469, in draw
self.figure.draw(self.renderer)
File "/usr/lib/python2.7/dist-packages/matplotlib/artist.py", line 59, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/matplotlib/figure.py", line 1079, in draw
func(*args)
File "/usr/lib/python2.7/dist-packages/matplotlib/artist.py", line 59, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/home/mrvaita/python_workspace/gis_venv/local/lib/python2.7/site-packages/cartopy/mpl/geoaxes.py", line 359, in draw
inframe=inframe)
File "/usr/lib/python2.7/dist-packages/matplotlib/artist.py", line 59, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/matplotlib/axes/_base.py", line 2092, in draw
a.draw(renderer)
File "/usr/lib/python2.7/dist-packages/matplotlib/artist.py", line 59, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/home/mrvaita/python_workspace/gis_venv/local/lib/python2.7/site-packages/cartopy/mpl/feature_artist.py", line 113, in draw
{})
File "/usr/lib/python2.7/weakref.py", line 433, in setdefault
return self.data.setdefault(ref(key, self._remove),default)
TypeError: unhashable type: 'MultiLineString'
有人已经对此有所了解吗? 我的matplotlib版本是1.4.2,而Cartopy版本是0.13.0
预先非常感谢您的帮助。
1楼
这是在Cartopy问题跟踪器上报告的一个问题, 为 。 基本上,Shapely在1.5.12和1.5.13之间更改了几何的哈希值。 在发布新版本的cartopy之前,解决方法是将您的shapely安装降级为1.5.12。
高温超导