nltk.corpus - 'getset_descriptor' 对象没有属性 'setdefault'

nltk.corpus - 'getset_descriptor' object has no attribute 'setdefault'

我正在使用下面的代码并从 nltk 导入停用词

   #from nltk.corpus import words as word_corp
    from nltk.corpus import stopwords
    nlp = spacy.load('en_core_web_sm')
    phrase_matcher = PhraseMatcher(nlp.vocab)
    en_words = nltk.corpus.words.words('en')
    stop_words = stopwords.words('english')

但是错误是AttributeError: 'getset_descriptor' object has no attribute 'setdefault' for ----> 3 nlp = spacy.load('en_core_web_sm')这一行。

我也遇到了这个问题 - 您使用的 Python/spaCy 是什么版本?

我遇到了 Python 3.9.1 + spaCy 2.2.4。

将 spaCy 升级到 3.0.0 后对我有用 将 Python 降级到 3.6.8(没有尝试其他版本)