Python https verification failure problem under Mac

created at 08-03-2021 views: 4

When I used you-get in mac, I found that the video could not be downloaded, so I downloaded the source code to debug and found an error

URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED>

reason

Searching on the Internet found that the https certificate verification failed

reason

This is because under the Mac operating system, Python no longer uses the system default certificate, and does not provide a certificate itself. When making HTTPS requests, you need to use the certificate provided by the certifi library

Specific instructions are here

/Applications/Python\ 3.9/ReadMe.rtf

solution

Execute the command to install and to solve the error

/Applications/Python\ 3.9/Install\ Certificates.command

Or install the package installed in the above command

pip install --upgrade certifi
created at:08-03-2021
edited at: 08-03-2021: