草庐IT

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

Johana_C 2023-04-05 原文

运行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

有关import _ssl # if we can‘t import it, let the error propagate的更多相关文章

  1. Ruby SSL 错误 - sslv3 警报意外消息 - 2

    我正在尝试在ruby​​脚本中连接到服务器https://www.xpiron.com/schedule。但是,当我尝试连接时:require'open-uri'doc=open('https://www.xpiron.com/schedule')我收到以下错误消息:OpenSSL::SSL::SSLError:SSL_connectreturned=1errno=0state=SSLv2/v3readserverhelloA:sslv3alertunexpectedmessagefrom/usr/local/lib/ruby/1.9.1/net/http.rb:678:in`conn

  2. ruby - 如何在非 SSL 或 http 网站上使用 Stripe? - 2

    我正在使用Rails3.2.6和Stipe进行支付。是否有可能在不购买ssl证书的情况下进行付款。我可以使用Stripe页面作为我的支付页面吗? 最佳答案 您可以使用stripe.js在技术上跳过SSL但我强烈建议您设置SSL。它所做的是将信用卡信息直接传递给stripe,然后stripe会给你一个token,用于实际进行收费。这样做意味着信用卡信息永远不会接触您的服务器,您不必担心PCI合规性。但是,您仍应设置SSL以防止中间人攻击。您可以在https://stripe.com/docs/tutorials/forms找到有关如何

  3. css - rails 萨斯 : variables are not passed with @import - 2

    我有一个使用twitterbootstrap和sass的Rails元素。scss文件结构化到文件夹中,所以我有更好的概述。现在我想为包含我的颜色等的全局变量定义一个文件,并将这些值传递给其他文件,这样我就有更少的冗余代码。虽然所有代码都已正确导入和应用,变量不起作用。这是当前的设置:样式表/application.css.scss/**=require_self*=require_tree*//*stylesheets/||–base/||–_reset.scss#Reset/normalize||–_typography.scss#Typographyrules||–componen

  4. ruby - HTTP POST 上的 SSL 错误(未知协议(protocol)) - 2

    尝试通过SSL连接到ImgurAPI时出现错误。这是代码和错误:API_URI=URI.parse('https://api.imgur.com')API_PUBLIC_KEY='Client-ID--'ENDPOINTS={:image=>'/3/image',:gallery=>'/3/gallery'}#Public:Uploadanimage##args-Theimagepathfortheimagetoupload#defupload(image_path)http=Net::HTTP.new(API_URI.host)http.use_ssl=truehttp.verify

  5. ruby - ssl`sysread_nonblock' : end of file reached (EOFError) - 2

    我编写了一个使用ruby​​线程的代码。require'rubygems'require'net/http'require'uri'defget_response()uri=URI.parse('https://..........')http=Net::HTTP.new(uri.host,uri.port)http.use_ssl=true----------endt1=[]15.timesdo|i|t1[i]=Thread.new{hit_mdm(i)sleep(rand(0)/10.0)}endt1.each{|t|t.join}代码工作正常,但是当程序执行到最后时它会抛出以下错

  6. ruby - 使用 Ruby/Puma 的本地 SSL - 2

    我正在运行本地puma服务器,但无法在SSL下加载资源。我有一个本地签名的证书。我正在尝试使用以下配置运行服务器:puma-b'ssl://127.0.0.1:9292?key=/path/to/certs/localhost.unecrypted.key&cert=/path/to/certs/localhost.crt'现在,当我访问https://localhost:9292或https://127.0.0.1:9292时,浏览器只是旋转并且没有来自服务器的响应。不返回任何资源。它两次向我显示HTML标题标签,但几乎总是什么也得不到。有什么想法吗?其他想法?确实需要在本地运行此应

  7. ruby-on-rails - ruby open ssl api for encrypted key (without nodes option) - 2

    在安装了openssllib的linux机器上,当您执行带有“-nodes”选项的“opensslpkcs12”时,您将获得带有未加密私钥的输出,但如果您跳过–nodes选项,则输出将具有加密的私钥。e.g.opensslpkcs12-intest.pfx-outtest.pem你应该看到像下面这样加密的私钥-----BEGINENCRYPTEDPRIVATEKEY-----MIIFDjBABgkqhkiGG7s=-----ENDENCRYPTEDPRIVATEKEY-----如何使用ruby​​的开放ssl库实现上述目标?这就是我用ruby​​生成私钥的方式:@private_key

  8. ruby-on-rails - 如何将 "import"嵌套类放入 Ruby 中的当前类? - 2

    在Ruby中,我可以将模块/类嵌套到其他模块/类中。我想要的是在文件或类中添加一些声明,以便能够通过短名称引用嵌套类,例如使用Inner获取Outer::Inner,就像在Java、C#等中一样。语法可能是这样的:moduleOuterclassInner;endclassAnotherInner;endendclassCimportOuter:[:Inner,:AnotherInner]deffInnerendend简单的实现可能是这样的:classClassdefimport(constants)@imported_constants=(@imported_constants||{

  9. ruby - 如何获得带有 SSL 客户端证书的 HTTPS 请求以与 Ruby EventMachine 一起使用? - 2

    我正在尝试使用RubyEventMachine访问使用SSL证书身份验证的HTTPSWeb服务,但我没有让它工作。我编写了以下简单代码块来对其进行端到端测试:require'rubygems'require'em-http'EventMachine.rundourl='https://foobar.com/'ssl_opts={:private_key_file=>'/tmp/private.key',:cert_chain_file=>'/tmp/ca.pem',:verify_peer=>false}http=EventMachine::HttpRequest.new(url).g

  10. ruby-on-rails - 萨翁 SSL 问题 - 2

    我正在努力让Savongem连接到我们的一台服务器。我不断收到一条错误消息,指出我无法通过ssl。我已经阅读了许多教程和修复程序,但似乎都没有用。感谢任何帮助-如果我能度过它,这将成为我的星期一:-)。错误:D,[2011-06-20T09:43:02.002993#10328]DEBUG--:RetrievingWSDLfrom:http://path_to_wsdl:4443/sm/services/mailing/2009/03/02?wsdlD,[2011-06-20T09:43:02.129057#10328]DEBUG--:HTTPIexecutesHTTPGETusing

随机推荐