我正在尝试运行一个简单的 Cartopy 示例:
import cartopy.crs as ccrs
import matplotlib.pyplot as plt
ax = plt.axes(projection=ccrs.PlateCarree())
ax.coastlines()
plt.show()
但我收到此错误:
几何图形必须是点或线串
python: geos_ts_c.cpp:4179: int GEOSCoordSeq_getSize_r(GEOSContextHandle_t, const geos::geom::CoordinateSequence*, unsigned int*): 断言
0 != cs' failed`。
我使用 miniconda3 安装了 Cartopy: conda install -c conda-forge cartopy
我还尝试使用 pip (在虚拟环境中)安装 Cartopy,但出现了相同的错误。
我的操作系统是 Debian Buster。
有什么想法吗?
最佳答案
问题是 shapely 版本错误,不应该使用 Cartopy 的二进制包,而应该从源代码构建。 这是解释here和 here .
所以我做到了:
pip uninstall shapely
pip install shapely --no-binary shapely
关于python - 使用 Cartopy 时,几何图形必须是点或线串错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60111684/