admin avatar

nltk.download('punkt') ssl error

🕟 by admin

使用 nltk.download 时出现的一个错误

plaintext: ssl error
1
2
3
4
5
6
>>> import nltk
>>> nltk.download('punkt')
[nltk_data] Error loading punkt: <urlopen error [SSL:
[nltk_data]     CERTIFICATE_VERIFY_FAILED] certificate verify failed:
[nltk_data]     unable to get local issuer certificate (_ssl.c:1091)>
False

解决方法

Python: python ssl
1
2
3
4
5
6
7
8
9
10
11
import nltk
import ssl

try:
    _create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
    pass
else:
    ssl._create_default_https_context = _create_unverified_https_context

nltk.download('punkt')

参考

💘 相关文章

写一条评论

Based on Golang + fastHTTP + sdb | go1.18.2 Processed in 0ms