简体   繁体   English

Python 3 MAC OS X的SSL证书错误

[英]SSL Certificate Error with Python 3 MAC OS X

I'm having an ssl certificate error anytime I try to download a module or data through python. 每当我尝试通过python下载模块或数据时,都会出现ssl证书错误。

I've read that this is due to the python 3.6 install on MAC OS X which does not use the native SSL. 我已经读到这是由于在Mac OS X上安装了python 3.6,它不使用本机SSL。 However, I installed my python using homebrew, and the usual fix of going to /Applications/python 3.6/Install Certificates.command doesn't work, because that file path doesn't exist. 但是,我使用自制软件安装了python,转到/Applications/python 3.6/Install Certificates.command的通常解决方法不起作用,因为该文件路径不存在。

I also tried pip3 install certifi which successfully installed, but that didn't solve the issue either. 我还尝试了成功安装的pip3 install certifi ,但这也不能解决问题。

What am I doing wrong? 我究竟做错了什么?

Edit: which python results in /usr/local/bin/python3 编辑: which python结果在/usr/local/bin/python3

python3 --version returns python 3.6.4 python3 --version返回python 3.6.4

I hit the same problem on Mac OS X 10.11.6 using Python 3.6.4. 我在使用Python 3.6.4的Mac OS X 10.11.6上遇到了相同的问题。 Here's a command and stacktrace from trying to install a Python module that is currently under development: 这是尝试安装当前正在开发的Python模块的命令和堆栈跟踪:

pip3 install --user dev-vcd-cli/
Processing ./dev-vcd-cli
    Complete output from command python setup.py egg_info:
    Download error on https://pypi.python.org/simple/pbr/: [SSL: 
CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777) -- Some packages may not be found!

The fix seems to be to update the pbr module as follows: 解决方法似乎是更新pbr模块,如下所示:

$ pip3 install --user pbr
Collecting pbr
  Using cached pbr-3.1.1-py2.py3-none-any.whl
Installing collected packages: pbr
Successfully installed pbr-3.1.1

After this the first pip3 install command succeeded. 此后,第一个pip3 install命令成功。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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