pip3.4问题与SSL证书但不是pip

时间:2015-10-15 01:00:48

标签: python ssl pip

我正在尝试使用我的MacOs X中的pip为python3.4安装库。还有系统带来的python2.7本机版本。所以,这很好用

> pip install numpy
Requirement already satisfied (use --upgrade to upgrade): numpy in 
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Cleaning up...

但是当我尝试安装python3.4时

pip3.4 install numpy

我得到了

Downloading/unpacking numpy
  Could not fetch URL https://pypi.python.org/simple/numpy/: There was a 
problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] 
certificate verify failed (_ssl.c:598)
  Will skip URL https://pypi.python.org/simple/numpy/ when looking for 
download links for numpy
  Could not fetch URL https://pypi.python.org/simple/: There was a 
problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] 
certificate verify failed (_ssl.c:598)
  Will skip URL https://pypi.python.org/simple/ when looking for download 
links for numpy
  Cannot fetch index base URL https://pypi.python.org/simple/
  Could not fetch URL https://pypi.python.org/simple/numpy/: There was a 
problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] 
certificate verify failed (_ssl.c:598)
  Will skip URL https://pypi.python.org/simple/numpy/ when looking for 
download links for numpy
  Could not find any downloads that satisfy the requirement numpy
  Cleaning up...
No distributions at all found for numpy

我已经读过pip版本1.5存在问题。特别是

> pip --version
pip 1.2.1 from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg (python 2.7)

,而

> pip3.4 --version
pip 1.5 from /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/pip-1.5-py3.4.egg (python 3.4)

这是我的问题吗?我该如何解决?

1 个答案:

答案 0 :(得分:0)

如果证书无效,理想情况下您应该导入系统并将其标记为受信任(如果您真的信任它)并通过以下方式指定:

pip --cert file.pem install numpy

或使用--trusted-host参数,例如:

pip --trusted-host https://pypi.python.org/simple/numpy/ install numpy

将此主机标记为受信任,即使它没有有效的证书。

另请参阅:SSL Cert Verification