AttributeError:模块“spacy”没有属性“load”

Arv*_*ind 6 python attributes load attributeerror spacy-3

import spacy
nlp = spacy.load('en_core_web_sm')

**Error:** Traceback (most recent call last):

  File "C:\Users\PavanKumar\.spyder-py3\ExcelML.py", line 27, in <module>
    nlp = spacy.load('en_core_web_sm')

AttributeError: module 'spacy' has no attribute 'load'
Run Code Online (Sandbox Code Playgroud)

有人能给我建议一个解决方案吗?

K. *_*tra 32

不要将文件命名为 spacy.py,它会产生冲突。


小智 3

尝试再次安装 spacy,我遇到了同样的问题,运行conda install spacy并重新启动我的笔记本内核后它就工作了。完整的安装文档请查看 spacy 官方网站:spacy 文档