Error when downloading Pytorch's own dataset =urllib.error.URLError: urlopen error [SSL: CERTIFICATE_VERIFY_FAILED]

wrong reason:

This is an SSL certificate verification error, which is reported when an https site is requested, but the certificate verification is wrong.

Solution:

Simply adding the following two lines to the code will skip the certificate check and successfully access the web page.

# 全局取消证书验证
import ssl
ssl._create_default_https_context = ssl._create_unverified_context

Guess you like

Origin blog.csdn.net/qq_39237205/article/details/121056693