AttributeError:模块'shapely'没有属性'affinity'

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

在Windows中正常安装后(从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'
python shapely
2个回答
0
投票

首先使用同一站点安装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模块。


0
投票

由于我无法添加信誉欠佳的评论,因此我想在此显示@BramAppel对解决方案的反馈。我遵循了您的指南,并成功安装了所有的whl文件,但是它不起作用。我在Windows 64位上使用python 3.6和Spyder。

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