如何修复pycharm中的“错误加载停用词”

问题描述 投票:0回答:1

我正在使用Pycharm并运行以下代码:

import nltk
nltk.download('stopwords')

我收到此错误消息吗?

[nltk_data] Error loading stopwords: <urlopen error [SSL:
[nltk_data]     CERTIFICATE_VERIFY_FAILED] certificate verify failed:
[nltk_data]     unable to get local issuer certificate (_ssl.c:1076)>

您能帮我吗?

ssl nltk
1个回答
0
投票

我找到了一个解决方案,我在这里分享,希望您有所帮助:

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('stopwords')
© www.soinside.com 2019 - 2024. All rights reserved.