简体   繁体   中英

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. I have recently uninstalled Conda and installed all my Python packages regularly. I'm trying to run my Django app on a local server and it no longer works. 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 ). 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. 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. 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. 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!

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