微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

python 安装库 报错 SSL: CERTIFICATE_VERIFY_FAILED 解决方法

目录

问题描述

临时解决方法

永久生效方法


问题描述

pip install virtualenv
Collecting virtualenv
/opt/python27/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:315: SNIMissingWarning: An HTTPS request has been made,but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate,which can cause validation failures. For more information,see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
  Could not fetch URL https://pypi.python.org/simple/virtualenv/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_Failed] certificate verify Failed (_ssl.c:590) - skipping
  Could not find a version that satisfies the requirement virtualenv (from versions: )

临时解决方法

使用–trusted-host命令行选项

pip --trusted-host pypi.python.org install virtualenv

安装其他库的时候只要出现类似错误 均可以使用此方法

永久生效方法

在 $HOME/.pip/pip.conf 中加入trusted-host选项,该方法是一劳永逸

[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐