gpt4 book ai didi

python - Cartopy 和 matplotlib TypeError : unhashable type: 'MultiLineString'

转载 作者:太空宇宙 更新时间:2023-11-04 10:19:16 25 4
gpt4 key购买 nike

我正在按照 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

非常感谢您的帮助。

最佳答案

这是在 https://github.com/SciTools/cartopy/issues/682 的 Cartopy 问题跟踪器上报告的一个问题.基本上,Shapely 在 1.5.12 和 1.5.13 之间改变了几何的可散列性。在我们发布新版本的 cartopy 之前,解决方法是将 shapely 的安装降级到 1.5.12。

HTH

关于python - Cartopy 和 matplotlib TypeError : unhashable type: 'MultiLineString' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33335287/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com