Я видел другие вопросы по этой теме c, но ни один из них не решил мою проблему. Я не установил anaconda в папку по умолчанию 'c: \ anaconda3', ТАКЖЕ я использую VSCode для разработки. Когда я запускаю свой код, который очень прост
import spacy
nlp = spacy.load("en_core_web_sm")
doc = nlp("Apple is looking at buying U.K. startup for $1 billion")
for token in doc:
print(token.text, token.pos_, token.dep_)
, я получаю сообщение об ошибке (указано ниже). Будучи новичком во всем этом, я не знаю, с чего начать. Пожалуйста, сообщите ...
Информация :
(base) C:\Users\ashish>conda info
active environment : base
active env location : c:\Software\Installed\anaconda3
shell level : 2
user config file : C:\Users\ashish\.condarc
populated config files : C:\Users\ashish\.condarc
conda version : 4.8.2
conda-build version : 3.18.11
python version : 3.7.6.final.0
virtual packages :
base environment : c:\Software\Installed\anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : c:\Software\Installed\anaconda3\pkgs
C:\Users\ashish\.conda\pkgs
C:\Users\ashish\AppData\Local\conda\conda\pkgs
envs directories : c:\Software\Installed\anaconda3\envs
C:\Users\ashish\.conda\envs
C:\Users\ashish\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/4.8.2 requests/2.22.0 CPython/3.7.6 Windows/10 Windows/10.0.17134
administrator : False
netrc file : None
offline mode : False
Я использую VSCode и когда я пытаюсь go до python из встроенного терминала я получаю следующую ошибку
C:\Projects\Internal Data Mining>python
Python 3.7.6 (default, Jan 8 2020, 20:23:39) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Warning:
This Python interpreter is in a conda environment, but the environment has
not been activated. Libraries may fail to load. To activate this environment
please see https://conda.io/activation
Type "help", "copyright", "credits" or "license" for more information.
Хотя из приглашения conda я активировал 'base'
Я установил Spacy и en_core_web_sm, информация о пакетах en_core_web_lg приведена ниже:
spacy 2.0.12 py37h8300f20_0
spacy-model-en_core_web_lg 2.2.5 py_0 conda-forge
spacy-model-en_core_web_sm 2.2.5 py_0 conda-forge
Основная ошибка :
[Running] python -u "c:\Projects\Internal Data Mining\SpacyTutorial.py"
Traceback (most recent call last):
File "c:\Projects\Internal Data Mining\SpacyTutorial.py", line 16, in <module>
nlp = spacy.load("en_core_web_sm")
File "C:\Software\Installed\anaconda3\lib\site-packages\spacy\__init__.py", line 15, in load
return util.load_model(name, **overrides)
File "C:\Software\Installed\anaconda3\lib\site-packages\spacy\util.py", line 114, in load_model
return load_model_from_package(name, **overrides)
File "C:\Software\Installed\anaconda3\lib\site-packages\spacy\util.py", line 135, in load_model_from_package
return cls.load(**overrides)
File "C:\Software\Installed\anaconda3\lib\site-packages\en_core_web_sm\__init__.py", line 12, in load
return load_model_from_init_py(__file__, **overrides)
File "C:\Software\Installed\anaconda3\lib\site-packages\spacy\util.py", line 173, in load_model_from_init_py
return load_model_from_path(data_path, meta, **overrides)
File "C:\Software\Installed\anaconda3\lib\site-packages\spacy\util.py", line 156, in load_model_from_path
return nlp.from_disk(model_path)
File "C:\Software\Installed\anaconda3\lib\site-packages\spacy\language.py", line 653, in from_disk
util.from_disk(path, deserializers, exclude)
File "C:\Software\Installed\anaconda3\lib\site-packages\spacy\util.py", line 511, in from_disk
reader(path / key)
File "C:\Software\Installed\anaconda3\lib\site-packages\spacy\language.py", line 649, in <lambda>
deserializers[name] = lambda p, proc=proc: proc.from_disk(p, vocab=False)
File "pipeline.pyx", line 643, in spacy.pipeline.Tagger.from_disk
File "C:\Software\Installed\anaconda3\lib\site-packages\spacy\util.py", line 511, in from_disk
reader(path / key)
File "pipeline.pyx", line 632, in spacy.pipeline.Tagger.from_disk.load_tag_map
File "morphology.pyx", line 56, in spacy.morphology.Morphology.__init__
File "attrs.pyx", line 147, in spacy.attrs.intify_attrs
KeyError: 'PUNCTSIDE_FIN'