当来自 cartopy 文档的 运行 个样本时如何处理分段错误?

How to deal with segmentation fault when running samples from cartopy documentation?

在 运行 任何 cartopy 示例(或任何使用 pyplot 和 cartopy 的绘图目的代码)系统 returns 分段错误

我已经尝试过此处列出的解决方案:

pip uninstall shapely
pip install --no-binary :all: shapely

当我尝试 运行 这个基本示例时:

import cartopy.crs as ccrs
import matplotlib.pyplot as plt

ax = plt.axes(projection=ccrs.PlateCarree())
ax.coastlines()

plt.show()

这是日志:

(python:19052): Gtk-WARNING **: 21:40:45.891: Theme parsing error: gtk.css:11546:3: '/*' in comment block

(python:19052): Gtk-WARNING **: 21:40:45.891: Theme parsing error: gtk.css:11652:2: '/*' in comment block
Segmentation fault (core dumped)

我在这个问题中找到了答案:https://github.com/SciTools/cartopy/issues/738

所以我只需要卸载 cartopy 和 shapely,然后使用:

pip install shapely cartopy --no-binary shapely --no-binary cartopy