【问题标题】:Trouble with TLS/SSL while installing requirements.txt file using pip使用 pip 安装 requirements.txt 文件时出现 TLS/SSL 问题
【发布时间】:2018-06-20 20:19:42
【问题描述】:

我正在尝试安装具有以下格式的 requirements.txt 文件:

build-utils==0.1.1
cffi==1.11.5
fake-rpi==0.6.0
keyboard==0.13.2
numpy==1.14.3
PyAudio==0.2.11
pycparser==2.18
RPi.GPIO==0.6.3
samplerate==0.1.0
websockets==5.0.1

我使用pip3 install -r ./PythonClient/requirements.txt 来安装不同的软件包。但是,我一直遇到 SSL 问题。

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting build-utils==0.1.1 (from -r ./PythonClient/requirements.txt (line 1))
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/build-utils/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/build-utils/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/build-utils/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/build-utils/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)': /simple/build-utils/
  Could not fetch URL https://pypi.org/simple/build-utils/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/build-utils/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping
  Could not find a version that satisfies the requirement build-utils==0.1.1 (from -r ./PythonClient/requirements.txt (line 1)) (from versions: )
No matching distribution found for build-utils==0.1.1 (from -r ./PythonClient/requirements.txt (line 1))
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

这是什么原因造成的,我该如何解决?

编辑:让我澄清一下。我正在尝试为 Mac OS 执行此操作。

【问题讨论】:

标签: python-3.x ssl pip tls1.2


【解决方案1】:

从这篇文章中我得出了答案:"SSL module in Python is not available" when installing package with pip3

如果你在 OSX 上并且已经从源代码编译了 python:

使用brew install openssl安装openssl

确保遵循 brew 提供的有关设置 CPPFLAGS >和 LDFLAGS 的说明。在我的情况下,我使用的是 openssl@1.1 brew 公式,我需要这 3 个 >python 构建过程的设置才能正确链接到我的 SSL 库:

export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

假设库安装在该位置。

【讨论】:

    猜你喜欢
    • 2021-06-21
    • 2015-03-25
    • 2019-08-02
    • 1970-01-01
    • 2017-04-27
    • 2018-06-19
    • 1970-01-01
    • 2018-12-07
    • 1970-01-01
    相关资源
    最近更新 更多