当前位置:   article > 正文

NLTK下载SSL:证书验证失败_[nltk_data] error loading punkt:

[nltk_data] error loading punkt:
  1. import nltk
  2. nltk.download()

尝试为nltk安装Punkt时出现以下错误:

nltk.download('punkt') [nltk_data] Error loading Punkt: <urlopen error [SSL: [nltk_data] CERTIFICATE_VERIFY_FAILED] certificate verify failed [nltk_data] (_ssl.c:590)> False

如果上面的链接死掉,这里是完整粘贴的解决方案:

  1. import nltk
  2. import ssl
  3. try:
  4. _create_unverified_https_context = ssl._create_unverified_context
  5. except AttributeError:
  6. pass
  7. else:
  8. ssl._create_default_https_context = _create_unverified_https_context
  9. nltk.download()

Python IDE中或通过命令行运行上面的代码.

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/377625
推荐阅读
相关标签