pip安装第三方库报错SSL: CERTIFICATE_VERIFY_FAILED

安装命令:

1
pip install --upgrade requests

报错内容:

1
Could not fetch URL https://pypi.org/simple/baostock/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/baostock/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1045)'))) - skipping

错误原因:
当前python版本是3.7,高版本python需要验证ssl,需要添加--trusted-host来跳过验证

解决办法:

1
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org requests

`