Python中安装包出现Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None))

用pip安装包时会出现下面的情况,原因是SSL错误。我们只要信任一下它就可以了

> WARNING: Retrying (Retry(total=4, connect=None, read=None,
> redirect=None, status
> =None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL:
> CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get
> local issuer  certificate (_ssl.c:1076)'))': /simple/requests/

解决方法:

pip install requests -i https://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com

这是豆瓣源:https://pypi.doubanio.com/simple/

如果不想每次都输入 -i https://pypi.doubanio.com/simple/,可以在这个目录下(window)C:\Users\Administrator\AppData\Roaming\pip\pip.ini
输入:

[global]
index-url = https://pypi.doubanio.com/simple/
[install]
trusted-host=pypi.doubanio.com

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