python-3.x - 使用 pip 安装 requirements.txt 文件时出现 TLS/SSL 问题

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

我正在尝试安装具有以下格式的 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 执行此操作。

最佳答案

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

If you are on OSX and have compiled python from source:

Install openssl using brew install openssl

Make sure to follow the instructions brew gives you about setting your CPPFLAGS >and LDFLAGS. In my case I am using the openssl@1.1 brew formula and I need these 3 >settings for the python build process to correctly link to my SSL library:

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"

Assuming the library is installed at that location.

关于python-3.x - 使用 pip 安装 requirements.txt 文件时出现 TLS/SSL 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50956418/

相关文章:

python - 从 python 列表创建子列表

python - for 循环后无法追加 numpy 数组吗?

ssl - Elastic Beanstalk : load balancer DNS unreachable

python - 在 python 3 中使用 pip 导入运行时安装的模块

python:如何从列表中打印单独的行?

python - 如何修复 suggest_users() 中的 Tweepy 错误 'Sorry, that page does not exist.'

ssl - 我如何通过关闭SHA256,SHA384,SHA,MD5,AES 128/128恢复RDP连接到Windows Server 2012 R2(驻留在AWS上)?

performance - Internet Explorer 11 中的第一个 HTTPS 连接非常慢,可能是什么?

mysql - 在Fedora25上安装mysqlclient时出错

python - pip 名冲突