Spacy 导入错误:无法从“spacy.lang.char_classes”导入名称“COMBINING_DIACRITICS”

问题描述 投票:0回答:1

当我尝试使用

import spacy
导入 NLP 库“Spacy”时,出现以下错误:

ImportError: cannot import name 'COMBINING_DIACRITICS' from 'spacy.lang.char_classes'

这是我的版本:

spacy==3.7.2
spacy-legacy==3.0.12

thinc==8.2.2

pydantic==1.8.2
pydantic_core==2.14.6

python version - 3.9.18

我尝试安装、卸载 Spacy、升级库以及所有其他常见检查。问题出在哪里?

完全错误:

ImportError                               Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_33180\572880994.py in 
----> 1 import spacy

c:\Users\anaconda3\lib\site-packages\spacy\__init__.py in 
     11 from thinc.api import Config, prefer_gpu, require_cpu, require_gpu  # noqa: F401
     12 
---> 13 from . import pipeline  # noqa: F401
     14 from . import util
     15 from .about import __version__  # noqa: F401

c:\Users\anaconda3\lib\site-packages\spacy\pipeline\__init__.py in 
----> 1 from .attributeruler import AttributeRuler
      2 from .dep_parser import DependencyParser
      3 from .edit_tree_lemmatizer import EditTreeLemmatizer
      4 from .entity_linker import EntityLinker
      5 from .entityruler import EntityRuler

c:\Users\anaconda3\lib\site-packages\spacy\pipeline\attributeruler.py in 
      6 from .. import util
      7 from ..errors import Errors
----> 8 from ..language import Language
      9 from ..matcher import Matcher
     10 from ..scorer import Scorer
...
      3     ALPHA_LOWER,
      4     ALPHA_UPPER,
      5     COMBINING_DIACRITICS,

ImportError: cannot import name 'COMBINING_DIACRITICS' from 'spacy.lang.char_classes' (c:\Users\anaconda3\lib\site-packages\spacy\lang\char_classes.py)
python pip nlp spacy pydantic
1个回答
0
投票

创建新环境并安装

scipy
,可以使用以下命令:

conda create -n myenv

激活

myenv
:

conda activate myenv

安装

scipy
检查安装页面:

conda install -c conda-forge spacy

然后你就可以使用

scipy

© www.soinside.com 2019 - 2024. All rights reserved.