What to do when "SSL: CERTIFICATE_VERIFY_FAILED _ssl.c: 1056" appears in Python

About my environment

The outline of the environment that caused the error is described. --macbookAir (It is important to be a mac for the time being) --I put python3.7 in Homebrew (this is the most important)

How to resolve the error

In my case, I got stuck when importing a dataset with sklearn. With the solution that comes up when I search on the net.

python3 executable code



>>>import certifi
>>>certifi.where()
'/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/certifi/cacert.pem'

And come out. You can use this as the key (?) For SSL authentication.

Execution code on terminal



$ touch /Library/Frameworks/Python.framework/Versions/3.7/etc/openssl/cert.pem #Without the file

$ ln -s /Library/Frameworks/Python.framework/Versions/3.7/etc/openssl/cert.pem /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/certifi/cacert.pem

$ ls -l /Library/Frameworks/Python.framework/Versions/3.7/etc/openssl
lrwxr-xr-x 1 username admin 96 11 22 10:04 cert.pem -> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/certifi/cacert.pem

And. This should probably solve it.

reference

[youtube-dl] python3 SSL error (CERTIFICATE_VERIFY_FAILED) Problem with CERTIFICATE_VERIFY_FAILED in Python 3.6 of the official installer for macOS

Recommended Posts

What to do when "SSL: CERTIFICATE_VERIFY_FAILED _ssl.c: 1056" appears in Python
[openpyxl] What to do when IllegalCharacterError appears in pandas.DataFrame.to_excel
What to do when a warning appears around Python integration in Neovim's CheckHealth
What to do when [Errno 2] No such file or directory appears in Python
What to do when "Invalid HTTP_HOST header" appears in Django
What to do if Insecure Platform Warning appears when running Python
What to do when ModuleNotFoundError: No module named'XXX' occurs in Python
What to do when the value type is ambiguous in Python?
What to do to get google spreadsheet in python
What to do if No Python documentation found for ... appears in pydoc
[Python] What to do when an error related to SSL authentication is returned
What to do when the warning "The environment is in consistent ..." appears in the Anaconda environment
[OSX] [pyenv] What to do when an SSL error occurs in pip
What I do when imitating embedded go in python
[Go 1.13] What to do when unexpected directory layout: appears
What to do when "cannot import name xxx" [Python]
I want to do something in Python when I finish
What to do when you can't bind CaboCha to Python
What to do when SSL error occurs in pip in Windows10, miniconda, VScode environment
What to do when "TypeError: data type not understood" appears in python's numpy.zeros
What to do if ʻarguments [0] .scrollIntoView ();` fails in python selenium
[Python] What to do when No module named'pyproj.datadir' appears when Exe is done with PyInstaller
What to do if you get an error when importing matplotlib in Python (Mac)
What to do with PYTHON release?
What to do when an error occurs with import _ssl
What to do when Python starts up in Anaconda does not come out unexpectedly
OSError: [Errno 40] What to do when Message too long appears
What to do when UnicodeDecodeError occurs during read_csv in pandas (pd.read_table ())
How to do R chartr () in Python
NameError: global name'dot_parser' is not defined and what to do when it comes up in python
[Memorandum] What to do when a warning appears after executing pip list
What to do if there is a decimal in python json .dumps
What to do if you can't use scikit grid search in Python
What to do when pyinstaller: error: argument --add-binary: invalid add_data_or_binary value: appears
[Docker] What to do when error Couldn't find the binary git appears
After all, what should I use to do type comparisons in Python?
What to do when a warning message is displayed in pip list
When codec can't decode byte appears in python
I want to do Dunnett's test in Python
[Python] What I did to do Unit Test
Minimal implementation to do Union Find in Python
How to write what to do when an application is first displayed in Qt for Python with Designer
What to do when PermissionError of tempfile.mkstemp occurs
What to do when "OS Error: [WinError 126] The specified module cannot be found" appears in import torch
[Python] What to do if you get a ModuleNotFoundError when importing pandas using Jupyter Notebook in Anaconda
What I did when updating from Python 2.6 to 2.7
[Question] What happens when I use% in python?
Error when trying to install psycopg2 in Python
[Python] What to do if an error occurs in pip (pyinstaller, pyautogui, etc.)
What to do when "TypeError: must be string, not int…" appears when using strptime
What to do if a Unicode Encode Error occurs in Sublime Text Python
What to do if you get an error when installing python with pyenv
What to do if you get "Python not configured." Using PyDev in Eclipse
[Python] What to check when you get a Unicode Decode Error in Django
What to do if abort is displayed when inputting camera video in OpenCV
What to do when the graph does not appear in jupyter (ipython) notebook
What to do if NotADirectoryError: [Errno 20] Not a directory:'xdg-settings' appears in jupyter notebook
What to do if pip install fails in Xcode 5.1
Things to keep in mind when developing crawlers in Python
curl: (60) What to do when Issuer certificate is invalid.
What to do when gdal_merge creates a huge file