MNIST手写数据集在运行中出现问题解决方案

  今天在运行手写数据集的过程中,出现一个问题,代码没有问题,但是运行的时候一直报错,错误如下:

urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1051)>


  查询网上的各种博客什么的,最后貌似是因为python3的原因出现的,目前采用的解决方案是在代码的顶端加上以下的几句代码,目前就可以很好的解决
import requests
requests.packages.urllib3.disable_warnings()
import ssl

try:
    _create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
    # Legacy Python that doesn't verify HTTPS certificates by default
    pass
else:
# Handle target environment that doesn't support HTTPS verification
    ssl._create_default_https_context = _create_unverified_https_context

 参考的网页如下:

https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000117730-SSL-error-in-accessing-MNIST-dataset



上一篇:Django路径问题


下一篇:Caching Doesn’t Improve Mobile Web Performance (Much)