我尝试为我的 EulerOS 安装 libosmesa-devel。它需要 Python (2.x) pip 来安装一些软件包。我已经安装了python3;所以,我安装了python2。然后,我在尝试使用 python2 安装 pip 时陷入困境。一般说明是下载 get-pip.py 并运行以下命令:
python2 get-pip
这会产生以下错误:
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(SSLError('_ssl.c:710: The handshake operation timed out',),)) - skipping
ERROR: Could not find a version that satisfies the requirement pip<21.0 (from versions: none)
ERROR: No matching distribution found for pip<21.0
对于第一行错误 - SSL 证书错误,我尝试了两种方法:
./configure --with-ssl
重建了 python-2.7.15-1.x86_64.rpm;没用。我尝试使用
--index-url http://pypi.python.org/simple/ --trusted-host pypi.python.org --trusted-host files.pythonhosted.org
参数来解决第一个错误,但它不起作用。
对于第一行错误 -
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(SSLError('_ssl.c:710: The handshake operation timed out',),)) - skipping
解决方案:将
https
更改为 http
--index-url http://pypi.python.org/simple/
所以,运行==>
python2 get-pip.py --index-url http://pypi.python.org/simple/ --trusted-host pypi.python.org --trusted-host files.pythonhosted.org
但这并没有解决以下错误-
ERROR: Could not find a version that satisfies the requirement pip<21.0 (from versions: none)
ERROR: No matching distribution found for pip<21.0
解决方案: 从给定的链接下载以下三个文件:
get-pip.py
相同的文件夹中并运行以下命令:python2 get-pip.py "pip-20.3.4-py2.py3-none-any.whl" "setuptools-44.1.1-py2.py3-none-any.whl" "wheel-0.37.1-py2.py3-none-any.whl" --index-url http://pypi.python.org/simple/ --trusted-host pypi.python.org --trusted-host files.pythonhosted.org
终于解决了问题!
Successfully installed pip-20.3.4 setuptools-44.1.1 wheel-0.37.1