python - AttributeError:模块“shapely”没有属性“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 模块。
推荐阅读
- node.js - Mongodb查找具有组合结果的元素数组
- java - java.io.IOException:流已关闭访问 jar 文件夹之外的配置文件
- java - 我的第一个程序无法按预期运行。当我放入所有变量时,它在正确使用时直接进入 else 语句
- r - 如何按组变异?
- html - 如何使用 HTML 和 CSS 绘制图像?
- java - 如何从 ServerResponse 获取正文作为字符串进行测试?
- android - 从 Date 对象获取时间,同时忽略 Timezone
- python - 根据属性的中值从 ee.ImageCollection 中选择图像
- c# - ID 令牌的受众 (aud) 声明不正确
- python - 如何在石墨烯解析器后使用中间件?