简体   繁体   中英

Can't import spacy

i've been trying to import spacy but everytime an error appears as a result. I used this line to install the package:

conda install -c conda-forge spacy

then i tried to import spacy and it gives me this error:

---------------------------------------------------------------------------
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)

Can anybody help me.

The problem is that the file you are working in is named spacy.py , which is interfering with the spacy module. So you should rename your file to something other than "spacy".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM