美文网首页
pip install的openssl问题

pip install的openssl问题

作者: amengtongxue | 来源:发表于2018-04-20 12:22 被阅读0次

新到手Mac上安装python环境,在pip install时出现以下错误:

Could not fetch URL https://pypi.python.org/simple/pip/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:661) - skipping

网上流传的解决方案:

  1. openssl的版本问题:
brew update
brew uninstall openssl
brew install openssl
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

update openssl之后需要重新安装python

  1. 通过trusted-host:
pip install --trusted-host pypi.python.org pip --upgrade
  1. 更换pip mirror:
$ cat ~/.config/pip/pip.conf
[global]
proxy = http://my-proxy:8080
index-url = http://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com
  1. update pip:
pip install --upgrade pip
  1. 通过源码重装pip:
$ curl 'https://bootstrap.pypa.io/get-pip.py' > get-pip.py
$ sudo python get-pip.py

我尝试了几种方法,1结合5解决了问题,但是具体原因没有进一步研究。

相关文章

网友评论

      本文标题:pip install的openssl问题

      本文链接:https://www.haomeiwen.com/subject/hvpakftx.html