正确安装 shapely 到系统解释器中以避免段错误

Correctly install shapely into system interpreter to avoid segfaults

现在我有以下代码,它因段错误而崩溃:

from shapely import geometry

print(geometry.Polygon([[0, 0], [0, 1], [1, 1], [1, 0]]))

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

我尝试使用 python3.7 -m pip install -U shapely --no-cache 重新安装,但没有任何效果。我的环境是 Ubuntu 18.04 和 Python 3.7 在任何虚拟环境之外。因此,关于将 shapely 安装到 anaconda 环境中的其他问题对我没有帮助。对如何做出匀称的作品有什么建议吗?

根据您的系统issue on GitHub this problem can appear when you have "mixed versions of the libgeos和预编译的 Shapely"。

运行 以下命令应该可以解决问题:

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