self._handle = _dlopen(self._name, mode) OSError: [WinError 126] 找不到指定的模块

在运行python代码时,报以下错误

D:\ProgramData\Anaconda3\envs\pytorch_gpu\python.exe E:/ZhuoZhuangOCR/Paper/Latest/DB-Resnet/DB/demo.py
Traceback (most recent call last):
  File "E:/ZhuoZhuangOCR/Paper/Latest/DB-Resnet/DB/demo.py", line 7, in <module>
    from experiment import Structure, Experiment
  File "E:\ZhuoZhuangOCR\Paper\Latest\DB-Resnet\DB\experiment.py", line 4, in <module>
    from structure.representers import *
  File "E:\ZhuoZhuangOCR\Paper\Latest\DB-Resnet\DB\structure\representers\__init__.py", line 1, in <module>
    from .seg_detector_representer import SegDetectorRepresenter
  File "E:\ZhuoZhuangOCR\Paper\Latest\DB-Resnet\DB\structure\representers\seg_detector_representer.py", line 3, in <module>
    from shapely.geometry import Polygon
  File "D:\ProgramData\Anaconda3\envs\pytorch_gpu\lib\site-packages\shapely\geometry\__init__.py", line 4, in <module>
    from .base import CAP_STYLE, JOIN_STYLE
  File "D:\ProgramData\Anaconda3\envs\pytorch_gpu\lib\site-packages\shapely\geometry\base.py", line 18, in <module>
    from shapely.coords import CoordinateSequence
  File "D:\ProgramData\Anaconda3\envs\pytorch_gpu\lib\site-packages\shapely\coords.py", line 8, in <module>
    from shapely.geos import lgeos
  File "D:\ProgramData\Anaconda3\envs\pytorch_gpu\lib\site-packages\shapely\geos.py", line 145, in <module>
    _lgeos = CDLL(os.path.join(sys.prefix, 'Library', 'bin', 'geos_c.dll'))
  File "D:\ProgramData\Anaconda3\envs\pytorch_gpu\lib\ctypes\__init__.py", line 364, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] 找不到指定的模块。

对于上面的错误,是在shapely的文件夹里面的代码报的错(要根据具体情况具体分析),可以看出这是由于shapely版本有问题
解决方法:

conda install -c conda-forge shapely 

安装完后,可能会出现

OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized. OMP: Hi

解决方法:加入下面这行代码

import os
os.environ['KMP_DUPLICATE_LIB_OK'] = 'TRUE'

参考链接:

  1. https://www.codeleading.com/article/10823667722/
  2. https://blog.csdn.net/peachhhh/article/details/114900589
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值