简体   繁体   English

Python 中的 SSL 模块不可用 - QGIS

[英]SSL module in Python is not available - QGIS

The following error seems to be quite common:以下错误似乎很常见:

C:\Program Files\QGIS 3.10\apps\Python37>python -m pip install doesnotmatterwhatIputhere
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

Most solutions I have seen assume Anaconda is somehow involved or some form of sudo, yum, brew, etc.我见过的大多数解决方案都假设 Anaconda 以某种方式参与或某种形式的 sudo、yum、brew 等。

I am (this time) using a QGIS interpreter on Windows 10, so none of the above apply.我(这次)在 Windows 10 上使用 QGIS 解释器,所以以上都不适用。

On the same computer, I have a standard installation of Python in C:\Python37 that works without fail.在同一台计算机上,我在 C:\Python37 中有一个 Python 的标准安装,它可以正常工作。 However, the same error also happened with an OSGeo4W64 install that I tried.但是,我尝试的 OSGeo4W64 安装也发生了同样的错误。

I have put C:\Program Files\QGIS 3.10\apps\Python37 (along with \Scripts and \Lib ) in my PATH variable to no avail - which is the closest I can come to simulating the multiplicity of Anaconda "solutions".我已将C:\Program Files\QGIS 3.10\apps\Python37 (连同\Scripts\Lib )放在我的 PATH 变量中但无济于事 - 这是我最接近模拟 Anaconda“解决方案”的多样性的方法。 The same error still results.仍然会出现同样的错误。

I have seen a multiplicity of posts about this problem.我看过很多关于这个问题的帖子。 Many of them have no answers at all and those that do seem to go the Anaconda route.他们中的许多人根本没有答案,而那些答案似乎是 go Anaconda 路线。 What about us snake-hating QGIS users?我们讨厌蛇的 QGIS 用户呢?

Finally I found a solution, installing the openssl for windows, works for all Qgis installations.最后我找到了一个解决方案,为 Windows 安装 openssl,适用于所有 Qgis 安装。 You can try, if you have openssl installed in your computer, trying to import ssl from your python version of Qgis.如果您的计算机上安装了 openssl,您可以尝试从您的 Python 版本的 Qgis 导入 ssl。

https://slproweb.com/products/Win32OpenSSL.html https://slproweb.com/products/Win32OpenSSL.html

在此处输入图片说明

The final solution that worked for me was found here: https://bugs.python.org/issue39344在这里找到了对我有用的最终解决方案: https://bugs.python.org/issue39344

Make sure the libcrypto-1_1-x64.dll and libssl-1_1-x64.dll files are in the same directory as your _ssl.pyd确保libcrypto-1_1-x64.dlllibssl-1_1-x64.dll文件与_ssl.pyd位于同一目录中

These files can be found in the C:\Program Files\QGIS 3.x\bin folder and will need to be copied to the C:\Program Files\QGIS 3.x\apps\Python3x\DLLs folder.这些文件可以在C:\Program Files\QGIS 3.x\bin文件夹中找到,需要复制到C:\Program Files\QGIS 3.x\apps\Python3x\DLLs文件夹。

尝试使用 OSGeo4W Shell 安装 python 包(需要安装 OSGeo4W)

我通过安装 32 位版本的 OSGeo4W 解决了这个问题。

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

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