Python 找不到形状平行的\u偏移

Python 找不到形状平行的\u偏移,python,attributeerror,shapely,Python,Attributeerror,Shapely,我试图使用Shapely平行偏移量,但似乎找不到。我已经包括了示例中的导入,但它无法识别并行偏移量 from matplotlib import pyplot from shapely.geometry import LineString from descartes import PolygonPatch line=LineString([(0,0),(0,1),(1,1),(2,0)]) offset = line.parallel_offset(1,'left',join_style=2

我试图使用Shapely
平行偏移量,但似乎找不到。我已经包括了示例中的导入,但它无法识别
并行偏移量

from matplotlib import pyplot
from shapely.geometry import LineString
from descartes import PolygonPatch

line=LineString([(0,0),(0,1),(1,1),(2,0)])
offset = line.parallel_offset(1,'left',join_style=2)
我得到:

$ python parallel_offset.py 
Traceback (most recent call last):
  File "parallel_offset.py", line 6, in <module>
    offset = line.parallel_offset(1,'left',join_style=2)
AttributeError: 'LineString' object has no attribute 'parallel_offset'
$python parallel\u offset.py
回溯(最近一次呼叫最后一次):
文件“parallel_offset.py”,第6行,在
偏移量=直线。平行偏移量(1,“左”,连接样式=2)
AttributeError:“LineString”对象没有属性“parallel\u offset”

我做错了什么?

此功能有两个需要满足的要求:

  • 形状>=1.2.8
  • GEOS>=3.2.0

此功能有两个需要满足的要求:

  • 形状>=1.2.8
  • GEOS>=3.2.0

我复制了下面的“您的代码行中的一些”,这也起到了作用

from shapely.geometry import LineString
line=LineString([(0,0),(0,1),(1,1),(2,0)])
offset = line.parallel_offset(1,'left',join_style=2)


您的原因可能是安装错误,因此请使用更新的版本重新安装。

我复制了下面的“少量代码行”,这也起到了作用

from shapely.geometry import LineString
line=LineString([(0,0),(0,1),(1,1),(2,0)])
offset = line.parallel_offset(1,'left',join_style=2)

原因可能是安装错误,请使用更新版本重新安装