首页 > 解决方案 > “pip 配置了需要 TLS/SSL 的位置,但是 Python 中的 ssl 模块不可用”

问题描述

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

anaconda                  2018.12                  py37_0

Python                    3.7.1

pip                       18.1

Dell Inspiron 13 7000 64-bit

我无法在命令提示符下使用 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

请帮助我理解为什么会这样。

标签: pythondownloadopensslpipanaconda

解决方案


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

  1. 在我的环境变量中添加了以下路径:
    • /AppData/Local/Continuum/Anaconda3
    • /AppData/Local/Continuum/Anaconda3/Scripts
    • /AppData/Local/Continuum/Anaconda3/库
    • /AppData/Local/Continuum/Anaconda3/Library/Bin

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

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

    python -m pip install --upgrade pip

这似乎纠正了 DLL 冲突。


推荐阅读