pip install的openssl问题

2018-04-20  本文已影响0人  amengtongxue

新到手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解决了问题,但是具体原因没有进一步研究。

上一篇 下一篇

猜你喜欢

热点阅读