繁体   English   中英

我正在尝试使用 windows 批处理文件来运行 python 代码,但是我遇到了以下错误:

[英]I'm trying to use a windows batch file to run python code, however I am encountering the following errors:

这是我主要试图开始工作的代码。 当我在 Spyder (Python 3.8) 中运行它时它运行良好。 但是,在运行 .bat 文件时,我收到以下错误消息。

urllib3.exceptions.SSLError: Can't connect to HTTPS URL 因为 SSL 模块不可用。

我还尝试运行一段不太复杂的代码,但它也不起作用,它的错误消息如下。 (这现在有效,见下文)

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

我的 .bat 文件代码如下(我认为 my.bat 文件代码很好,因为其中一个现在运行完美,所以这不是路径问题):

C:\Users\Thomas\Desktop\Coding\Python\Chess_Files>"C:\Users\Thomas\Anaconda3\python.exe" "C:\Users\Thomas\Desktop\Coding\Python\Python_Code\lichessAPI.py"
C:\Users\Thomas\Desktop\Coding\Python\Chess_Files>"C:\Users\Thomas\Anaconda3\python.exe" "C:\Users\Thomas\Desktop\Coding\Python\Python_Code\planetorbits.py"

更新:通过使用 pip 卸载并重新安装 numpy 和 matplotlib,我能够使代码的 second.bat 文件正常工作。 但是,first.bat 文件仍然遇到相同的错误。

有人建议我安装 openSSL,我不确定那是什么以及为什么我不能只使用 urllib3,因为当我自己在 anaconda 中运行代码时,我不能使用 urllib3。

最后更新:我找到了一个解决方案并将其发布在下面。 希望这可以帮助。

按照 Matt Dnv 的建议,我能够解决这个问题:

Requests (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.") Error in PyCharm requesting website

我复制并粘贴了以下内容:

libcrypto-1_1-x64.*
libssl-1_1-x64.*

从 D:\Anaconda3\Library\bin 到 D:\Anaconda3\DLLs

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM