python安装第三方包异常【SSLEOFError】、[SSL: CERTIFICATE_VERIFY_FAILED]

Could not fetch URL https://pypi.org/simple/xxxx/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/xxxx
l/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:852)'),)) - skipping
ERROR: Could not find a version that satisfies the requirement xxxx (from versions: none)
ERROR: No matching distribution found for xxxx

python安装第三方包异常【SSLEOFError】、[SSL: CERTIFICATE_VERIFY_FAILED]_第1张图片

原因:

python高版本需要验证ssl,可以添加--trusted-host 来解决,所有host都得--trusted-host

解决:

# 这里用的国内清华镜像源,注意安装包xxxx需要替换为你要安装的第三方包
pip --trusted-host pypi.python.org --trusted-host pypi.tuna.tsinghua.edu.cn install xxxx -i https://pypi.tuna.tsinghua.edu.cn/simple/

你可能感兴趣的:(python)