AttributeError: module 'shapely' has no attribute 'affinity'

AttributeError: module 'shapely' has no attribute 'affinity'

在 windows 中安装 shapely 后(从 https://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely 下载 .whl 文件)出现以下错误:

from shapely.geometry import Point
Traceback (most recent call last):

  File "<ipython-input-48-df8e65c5217a>", line 1, in <module>
    from shapely.geometry import Point

  File "C:\Anaconda3\lib\site-packages\shapely\geometry\__init__.py", line 23, in <module>
    import shapely.speedups

  File "C:\Anaconda3\lib\site-packages\shapely\speedups\__init__.py", line 99, in <module>
    enable()

  File "C:\Anaconda3\lib\site-packages\shapely\speedups\__init__.py", line 69, in enable
    _orig['affine_transform'] = shapely.affinity.affine_transform

AttributeError: module 'shapely' has no attribute 'affinity'

首先使用相同的站点安装 Shapely 的依赖项。对我来说,以下程序有效。我在 windows 64 位上使用 python 3.6。

按以下顺序安装轮子:

1: GDAL-2.4.1-cp36-cp36m-win_amd64.whl

2: Fiona-1.8.6-cp36-cp36m-win_amd64.whl

3: Shapely-1.6.4.post2-cp36-cp36m-win_amd64.whl

这应该会导致正确安装 Shapely 模块。