“pip 配置了需要 TLS/SSL 的位置,但是 Python 中的 ssl 模块不可用”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/54394764/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 20:28:39  来源:igfitidea点击:

"pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available"

pythondownloadopensslpipanaconda

提问by James Carter

I have the anaconda package and run Spyder. Here is my system information:

我有 anaconda 包并运行 Spyder。这是我的系统信息:

anaconda                  2018.12                  py37_0

Python                    3.7.1

pip                       18.1

Dell Inspiron 13 7000 64-bit

I am unable to install anything with pip from the command prompt. I get the following when trying to install numpy for instance (which I already have through anaconda):

我无法从命令提示符使用 pip 安装任何东西。例如,我在尝试安装 numpy 时得到以下信息(我已经通过 anaconda 安装了它):

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

Requirement already satisfied: numpy in c:\users\uday rallabhandi\anaconda3\lib\site-packages (1.15.4)

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

Please help me understand why this is happening.

请帮助我理解为什么会发生这种情况。

采纳答案by Inigo Selwood

Here was my process to correct the error, on Windows 10 with Anaconda:

这是我在使用 Anaconda 的 Windows 10 上纠正错误的过程:

  1. Added the following paths to my environment variables:
    • /AppData/Local/Continuum/Anaconda3
    • /AppData/Local/Continuum/Anaconda3/Scripts
    • /AppData/Local/Continuum/Anaconda3/Library
    • /AppData/Local/Continuum/Anaconda3/Library/Bin
  1. 将以下路径添加到我的环境变量中:
    • /AppData/Local/Continuum/Anaconda3
    • /AppData/Local/Continuum/Anaconda3/Scripts
    • /AppData/Local/Continuum/Anaconda3/Library
    • /AppData/Local/Continuum/Anaconda3/Library/Bin

At this stage, the error message was still there.

在这个阶段,错误信息仍然存在。

  1. From Anaconda Prompt, I installed the latest version of pip:

    python -m pip install --upgrade pip

  1. 从 Anaconda Prompt,我安装了最新版本的 pip:

    python -m pip install --upgrade pip

This appeared to correct the DLL conflict.

这似乎纠正了 DLL 冲突。

回答by Gabriel Castro Lima

I had exactly the same problem. My computer is exactly the same and the versions of Python and pip are also the same.

我遇到了完全相同的问题。我的电脑一模一样,Python和pip的版本也一样。

It's a dll conflict with libeay32.dll.

这是与 libeay32.dll 的 dll 冲突。

I can solve this problem by adding dir path of python which has libeay32.dll (in my case C:\Users\Gabriel\Anaconda3\pkgs\openssl-1.1.1a-he774522_0\Library\bin) in system environment as topmost position.

我可以通过在系统环境中添加 libeay32.dll(在我的例子中为 C:\Users\Gabriel\Anaconda3\pkgs\openssl-1.1.1a-he774522_0\Library\bin)作为最顶层位置的 python 目录路径来解决这个问题。

回答by AFK

Try your install/update with pip3instead of pip.

尝试使用pip3而不是pip 进行安装/更新。

回答by zqcolor

I do not have libeay32.dll in bin folder either, but after adding C:\Users\<user name>\Anaconda3\pkgs\openssl-1.1.1a-he774522_0\Library\binto the top of path, it is working. This is on Windows 10 64-bit.

我在 bin 文件夹中也没有 libeay32.dll,但是在添加C:\Users\<user name>\Anaconda3\pkgs\openssl-1.1.1a-he774522_0\Library\bin到路径顶部后,它正在工作。这是在 Windows 10 64 位上。

回答by Bob

Activate your base conda environment:

激活您的基本 conda 环境:

conda activate base

conda activate base

回答by Student222

Adding "<Path to miniconda or anaconda>\Library\bin"folder to PATH solved this problem for me.

“<Miniconda 或 anaconda 的路径>\Library\bin”文件夹添加到 PATH 为我解决了这个问题。

回答by Sourabh Sinha

I had the same issue when I created a new environment in anaconda, activated it and tried to install a library with pip. What was missing was:

当我在 anaconda 中创建一个新环境,激活它并尝试使用 pip 安装一个库时,我遇到了同样的问题。缺少的是:

conda install pip

then everything worked for me.

然后一切都对我有用。

回答by Megha Bhamare

Activating the base and then activated my Django environment.

激活基础然后激活我的 Django 环境。

(Django_env) (base) C:\virtual_environment\Django_env> , which actually worked for me.

(Django_env) (base) C:\virtual_environment\Django_env> ,这实际上对我有用。