创建shapely的Polygon后,会得到malloc

问题描述 投票:0回答:1

我有以下坐标,我想计算多边形的面积。在我还没来得及计算面积的时候,我就遇到了下面的malloc错误。

python3(24115,0x1150b2dc0) malloc: *** error for object 0x10fe90960: pointer being freed was not allocated
python3(24115,0x1150b2dc0) malloc: *** set a breakpoint in malloc_error_break to debug
zsh: abort      python3 polygons.py

我的代码:

from shapely.geometry import Polygon
points = [(1.9046687355667333, 56.23551023807152), (1.9048036984917063, 56.24680521031975), (1.9197029814434226, 56.24663611723459), (1.9346024475394754, 56.24648039234242), (1.9495020841662953, 56.2463380360075), (1.9644018787283948, 56.246209048575835), (1.9793018186014029, 56.24609343040593), (1.994201891192725, 56.24599118182762), (1.9941284953105824, 56.23469488377984), (1.9792181613441933, 56.23479733138695), (1.96430796016182, 56.23491315736771), (1.949397904385022, 56.235042361374965), (1.9344880066132888, 56.23518494306894), (1.9195782794710594, 56.235340902086214), (1.9046687355667333, 56.23551023807152)]
Polygon(points)

我的代码: EDIT:运行在MacOS Catalina 10.15.4上

Python 3.7.3

pip版本:20.0.2

shapely.pip版本: 20.0.2 1.7.0

python shapely
1个回答
0
投票

问题出在Python环境上。我不得不创建一个新的环境,并安装所有的依赖项,然后就可以了。

© www.soinside.com 2019 - 2024. All rights reserved.