pip3无法获取URLhttps://pypi.org/simple/pip/:确认ssl证书时出现问题



我从这里安装了python3.7https://tecadmin.net/install-python-3-6-on-centos/当尝试使用/升级/安装pip时,我得到了以下错误:

[cloudera@quickstart Python-3.7.6rc1]$ sudo pip3 install --upgrade
WARNING: pip is configured with locations that require TLS/SSL,
however the ssl module in Python is not available.
ERROR: You must give at least one requirement to install (see "pip
help install")
WARNING: 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

版本信息

[cloudera@quickstart Python-3.7.6rc1]$ pip3 --version
pip 19.2.3 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)
[cloudera@quickstart Python-3.7.6rc1]$ whereis pip3
pip3: /usr/local/bin/pip3 /usr/local/bin/pip3.7
[cloudera@quickstart Python-3.7.6rc1]$ whereis pip
pip: /usr/bin/pip2.6 /usr/bin/pip /usr/local/bin/pip3.7
[cloudera@quickstart Python-3.7.6rc1]$ python3 --version
Python 3.7.6rc1
[cloudera@quickstart Python-3.7.6rc1]$ whereis openssl
openssl: /usr/src/openssl-1.0.2o/openssl.doxy
/usr/src/openssl-1.0.2o/openssl.spec
/usr/src/openssl-1.0.2o/openssl.pc /usr/bin/openssl /usr/lib64/openssl
/usr/local/bin/openssl /usr/include/openssl
/usr/share/man/man1/openssl.1ssl.gz

我尝试了这里为这个错误建议的几个命令,但没有任何帮助。你能帮我吗?

更新

[cloudera@quickstart Python-3.7.6rc1]$ sudo pip3 install upgrade pip
WARNING: pip is configured with locations that require TLS/SSL,
however the ssl module in Python is not available.
Collecting upgrade
WARNING: 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/upgrade/
WARNING: 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/upgrade/
WARNING: 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/upgrade/
WARNING: 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/upgrade/
WARNING: 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/upgrade/
Could not fetch URL https://pypi.org/simple/upgrade/: There was a
problem confirming the ssl certificate:
HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded
with url: /simple/upgrade/ (Caused by SSLError("Can't connect to HTTPS
URL because the SSL module is not available.")) - skipping
ERROR: Could not find a version that satisfies the requirement
upgrade (from versions: none)
ERROR: No matching distribution found for upgrade
WARNING: 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

遵循以下步骤:

pip-install--可信主机pypi.org--可信主机文件.pythonhosted.orgPACKAGE_NAME

示例-->pip-install--可信主机pypi.org--可信主机文件.pythonhosted.orgmatplotlib

希望这有帮助:(

您可能缺少python的一些基本需求。尝试使用安装所有sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

我通过在可执行文件所在的目录中启动pip来解决这个问题。永久性的解决方案是添加所需的bin&将目录脚本化为Path。

别忘了重新启动docker,并确保您可以连接到互联网。

解决方案:

在经历了所有地方之后,我最终卸载了python和vs代码。删除了保存在%AppData%下的所有vs代码、python和pip缓存文件。重新安装的python和vs代码。

成功。

pip是19.0.3,我保持这种方式,因为我认为问题是从我更新到20.3.3时开始的。一旦更新到20.3.3,由于SSL错误,您将无法将其降级。

请尝试安装命令,将受信任的主机添加到pip中,如下所示:

sudo pip3 install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org -upgrade pip

我喜欢这篇文章对问题的解释和其他解决方案。

最新更新