我正在尝试安装具有以下格式的 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/