赞
踩
Traceback (most recent call last):
File “D:\dataset\sap-sam-main\src\sapsam\detector.py”, line 1, in
import spacy
File “D:\Anaconda\envs\sapsam\lib\site-packages\spacy_init_.py”, line 14, in
from . import pipeline # noqa: F401
File “D:\Anaconda\envs\sapsam\lib\site-packages\spacy\pipeline_init_.py”, line 1, in
from .attributeruler import AttributeRuler
File “D:\Anaconda\envs\sapsam\lib\site-packages\spacy\pipeline\attributeruler.py”, line 6, in
from .pipe import Pipe
File “spacy\pipeline\pipe.pyx”, line 1, in init spacy.pipeline.pipe
File “spacy\vocab.pyx”, line 1, in init spacy.vocab
File “D:\Anaconda\envs\sapsam\lib\site-packages\spacy\tokens_init_.py”, line 1, in
from .doc import Doc
File “spacy\tokens\doc.pyx”, line 36, in init spacy.tokens.doc
File “D:\Anaconda\envs\sapsam\lib\site-packages\spacy\schemas.py”, line 222, in
class TokenPattern(BaseModel):
File “pydantic\main.py”, line 205, in pydantic.main.ModelMetaclass.__new__
File “pydantic\fields.py”, line 491, in pydantic.fields.ModelField.infer
File “pydantic\fields.py”, line 421, in pydantic.fields.ModelField.__init__
File “pydantic\fields.py”, line 537, in pydantic.fields.ModelField.prepare
File “pydantic\fields.py”, line 634, in pydantic.fields.ModelField._type_analysis
File “pydantic\fields.py”, line 641, in pydantic.fields.ModelField._type_analysis
File “D:\Anaconda\envs\sapsam\lib\typing.py”, line 774, in __subclasscheck__
return issubclass(cls, self.__origin__)
TypeError: issubclass() arg 1 must be a class
pydantic 的版本和 spacy 的版本不匹配出现该问题
1.卸载 pydantic
pip uninstall pydantic
2.重新安装 pydantic 会出现错误提示信息
pip install pydantic
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
confection 0.1.0 requires pydantic!=1.8,!=1.8.1,<1.11.0,>=1.7.4, but you have pydantic 2.1.1 which is incompatible.
spacy 3.4.1 requires pydantic!=1.8,!=1.8.1,<1.10.0,>=1.7.4, but you have pydantic 2.1.1 which is incompatible.
thinc 8.1.10 requires pydantic!=1.8,!=1.8.1,<1.11.0,>=1.7.4, but you have pydantic 2.1.1 which is incompatible.
spacy 3.4.1 需要 pydantic 版本 !=1.8,!=1.8.1,<1.10.0,>=1.7.4
3.卸载 pydantic 重新安装1.7.4版本的 pydantic
pip install pydantic==1.7.4
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。