There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate ve

在安装virtualenv的时候发现有如下报错:
There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate ve_第1张图片

Collecting virtualenv
  Cache entry deserialization failed, entry ignored
  Could not fetch URL https://pypi.tuna.tsinghua.edu.cn/simple/virtualenv/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777) - skipping
  Could not find a version that satisfies the requirement virtualenv (from versions: )
No matching distribution found for virtualenv
You are using pip version 9.0.1, however version 23.1.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

大致意思就是在说因为在确认ssl证书时出现了问题,从而导致无法无法获取https://pypi.tuna.tsinghua.edu.cn/simple/virtualenv/。

解决方法:

pip install xxx后面加上参数--trusted-host xxx(网站网址),例如:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U --trusted-host pypi.tuna.tsinghua.edu.cn

以此类推,可以更改成其他的源,如果你用的豆瓣源就可以写:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U --trusted-host pypi.tuna.tsinghua.edu.cn

效果如下所示:
There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate ve_第2张图片
我这里是在升级pip,也可以换成其他的第三方库。使用过一次这个参数之后,以后安装第三方库的时候不需要重复添加,我在使用一次--trusted-host之后安装vitualenv以及其他第三方库的时候,不会重复出现报错:
There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate ve_第3张图片

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