无法导入spacy

Can't import spacy

我一直在尝试导入 spacy 但每次都会出现错误。 我用这一行来安装包:

conda install -c conda-forge spacy

然后我尝试 import spacy 但它给了我这个错误:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-11-76a01d9c502b> in <module>
----> 1 import spacy

~\Python\Text\spacy.py in <module>
      9 import spacy
     10 # Load English tokenizer, tagger, parser, and NER
---> 11 nlp = spacy.load('en_core_web_sm')
     12 # Process whole documents
     13 text = ("When Sebastian Thrun started working on self-driving cars at "

AttributeError: partially initialized module 'spacy' has no attribute 'load' (most likely due to a circular import)

谁能帮帮我。

问题是您正在使用的文件名为 spacy.py,它干扰了 spacy 模块。因此,您应该将文件重命名为“spacy”以外的名称。