简体   繁体   中英

pip3.4 issue with SSL certificate but NOT pip

I am trying to install libraries for python3.4 using pip in my MacOs X. There is also the python2.7 native version that the system brings. So, this works fine

> 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...

But when I try to install for python3.4

pip3.4 install numpy

I get

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

I have read that there are problems with the pip version 1.5. In particular

> 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)

while

> 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)

Is this my issue? How do I solve it?

If the certificate is not valid, ideally you should import into your system and mark it trusted (if you really trust it) and specify by:

pip --cert file.pem install numpy

Or use --trusted-host parameter, eg:

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

to mark this host as trusted, even though it does not have valid certificate.

See also: SSL Cert Verification .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM