Python 3.x 使用pip安装requirements.txt文件时TLS/SSL出现问题
我正在尝试安装具有以下格式的requirements.txt文件:Python 3.x 使用pip安装requirements.txt文件时TLS/SSL出现问题,python-3.x,ssl,pip,tls1.2,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安装-r./PythonClient/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安装-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做这件事 我从这篇文章中得出了答案: 如果您在OSX上,并且已从源代码编译python: 使用
brew安装openssl安装openssl
确保按照brew提供的有关设置CPPFALGS>和LDFLAGS的说明进行操作。就我而言,我使用的是openssl@1.1brew formula和我需要以下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"
假设库安装在该位置
您的python似乎不是用ssl库构建的。也许这篇文章会有帮助:还有,你在使用哪种操作系统?是的,你是对的。可能是@phd的副本,我为之前没有澄清而道歉。我正在寻找一种针对Mac OS的解决方案,因此其他帖子并没有回答我的问题。