解决方案:pip提示有新版本,但是无法更新

问题描述:

用pip安装第三方库失败,报错pip版本不正确,需要升级到最新版本,报错信息如下:

Could not fetch URL https://pypi.org/simple/sudo/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/sudo/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)'))) - skipping
ERROR: Could not find a version that satisfies the requirement sudo (from versions: none)
ERROR: No matching distribution found for sudo
WARNING: You are using pip version 20.2.3; however, version 21.1.1 is available.
You should consider upgrading via the '/Users/zhengkun/Downloads/crm_autotest-master/venv/bin/python3.9 -m pip install --upgrade pip' command.

 

使用命令sudo pip3 install --upgrade 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(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)'))) - skipping
Requirement already up-to-date: pip in ./venv/lib/python3.9/site-packages (20.2.3)
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(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)'))) - skipping

解决方案:

使用国内豆瓣的镜像去安装可以成功安装

命令:sudo pip3 install --upgrade pip -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

你可能感兴趣的:(环境,python,pip)