前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >windows 调用 from shapely.geos import lgeos 时报错

windows 调用 from shapely.geos import lgeos 时报错

作者头像
为为为什么
发布2022-08-05 15:10:50
1.1K0
发布2022-08-05 15:10:50
举报
文章被收录于专栏:又见苍岚又见苍岚

在Windows python中使用 from shapely.geos import lgeos 会报错,错误一般由于调用了依赖**shapely** 库的代码,比如我就是在调用 imgaugclip_out_of_image函数时报错,本文记录解决方案。

问题复现

代码语言:javascript
复制
poly.clip_out_of_image(image_aug)

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\imgaug\augmentables\polys.py", line 575, in clip_out_of_image
    import shapely.geometry
  File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\shapely\geometry\__init__.py", line 4, in <module>
    from .base import CAP_STYLE, JOIN_STYLE
  File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\shapely\geometry\base.py", line 18, in <module>
    from shapely.coords import CoordinateSequence
  File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\shapely\coords.py", line 8, in <module>
    from shapely.geos import lgeos
  File "C:\Users\Admin\AppData\Roaming\Python\Python37\site-packages\shapely\geos.py", line 145, in <module>
    _lgeos = CDLL(os.path.join(sys.prefix, 'Library', 'bin', 'geos_c.dll'))
  File "E:\Program_Files\Annoconda\lib\ctypes\__init__.py", line 356, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] 找不到指定的模块。

解决方案

我们看到里面有一个关于geos_c.dll的文件,而报错的主要原因就出现在geos_c.dll这里,看了网上很多文章大部分说是geos_c.dll文件缺失的原因。

参考资料

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2021年5月21日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 问题复现
  • 解决方案
  • 参考资料
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档