import _ssl # if we can‘t import it, let the error propagate

运行gym_derk时,导入ssl出错。

完整报错如下:

import _ssl # if we can't import it, let the error propagate

ImportError: DLL load failed while importing _ssl: 找不到指定的模块。

尝试了很多解决方法,最后是通过找到以下两个文件,复制到运行环境的DLLs的目录下解决的。

libcrypto-1_1-x64.dll
libssl-1_1-x64.dll

以我自己的为例,我的运行环境名为pytorch

上述两个dll文件一般会存在运行环境的bin文件夹中,比如在我这里的路径是这个:

D:\Anaconda3\envs\pytorch\bin

然后粘到对应的DLLs目录下问题解决,在我这里是这个:

D:\Anaconda3\envs\pytorch\DLLs

在粘贴之前要先检测下DLLs文件夹下有没有_ssl.pyd文件,因为把这两个dll文件粘贴过去的原因就是_ssl.pyd运行需要它们,所以要把它们粘到与_ssl.pyd相同的文件目录下。

我第一次尝试这个方法的时候是从GitHub上看到的,但他只让我粘libssl-1_1.dll和libcrypto-1_1.dll,但粘过去之后还是报错,后来看到应该用后面有x64的。

GitHub回答链接是这个:

Getting error while importing ssl " import _ssl # if we can't import it, let the error propagate ImportError: DLL load failed while importing _ssl: The specified module could not be found." · Issue #83525 · python/cpython · GitHub

还有其他解决方法可以参考下这个博客,写的很全:

(20条消息) import _ssl ImportError: DLL load failed_学习记录册的博客-CSDN博客_import _ssl

  • 17
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 13
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值