[英]How do I fix <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)> in Python?
I have a Django web app that used to work when I had Python installed with Conda. 我有一个Django网络应用程序,当我在Conda上安装Python时可以使用。 I have recently uninstalled Conda and installed all my Python packages regularly.
我最近卸载了Conda,并定期安装了所有Python软件包。 I'm trying to run my Django app on a local server and it no longer works.
我正在尝试在本地服务器上运行我的Django应用程序,它不再起作用。 I've discovered the problem is this error:
我发现问题是此错误:
URLError at /submit/
<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)>
Request Method: POST
Request URL: http://127.0.0.1:8000/submit/
Django Version: 2.1.1
Exception Type: URLError
Exception Value:
<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)>
Exception Location: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py in do_open, line 1320
Python Executable: /Library/Frameworks/Python.framework/Versions/3.6/bin/python3
Python Version: 3.6.5
I understand there have been some updates regarding certificates with Python 3.6 (see bottom of this article ). 我了解关于Python 3.6的证书已有一些更新(请参阅本文的底部)。 I am hoping to find a simple fix to allow me to continue running this Django app on a local host, and I'm hoping to continue using Python 3.6 without Conda.
我希望找到一个简单的修复程序,以允许我继续在本地主机上运行此Django应用程序,并且希望在不使用Conda的情况下继续使用Python 3.6。 I could try using a virtualenv with a different version of Python installed but I'd like to know if I can still use 3.6.
我可以尝试使用安装了不同版本Python的virtualenv,但我想知道我是否仍然可以使用3.6。 Any insights are appreciated!
任何见解表示赞赏!
The second solution in this post solved it for me. 这篇文章中的第二个解决方案为我解决了。
I tried pip install --upgrade certifi
, but this didn't solve it. 我尝试了
pip install --upgrade certifi
,但这没有解决。 Running the /Applications/Python 3.6/Install Certificates.command
script, which itself ran pip install --upgrade certifi
, as well as a few other things, worked! 运行
/Applications/Python 3.6/Install Certificates.command
脚本(该脚本本身运行了pip install --upgrade certifi
)以及其他一些功能,都可以运行!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.