Sslcertverificationerror when downloading using Python: [SSL: certificate_verify_failed] error

When downloading the dataset on the pytorch official website, an error is reported in sslcertverificationerror: [SSL: certificate_verify_failed]. The following is my solution.

Error reason: when opening HTTPS link with urllib, SSL certificate will be checked once. When the target website uses a self signed certificate, it will throw the error of urlib2.urlerror.

Solution: cancel certificate validation globally
Import SSL
SSL_ create_ default_ https_ context = ssl._ create_ unverified_ context

Reference article link: https://blog.csdn.net/yixieling4397/article/details/79861379

Read More: