python-3.x ImportError:无法从“typing_extensions”导入名称“deprecated”

bqf10yzr  于 12个月前  发布在  Python
关注(0)|答案(2)|浏览(1320)

我想下载spacy,但typing-extensions的版本在终端中降低了:

ERROR: pydantic 2.3.0 has requirement typing-extensions>=4.6.1, but you'll have typing-extensions 4.4.0 which is incompatible.
ERROR: pydantic-core 2.6.3 has requirement typing-extensions!=4.7.0,>=4.6.0, but you'll have typing-extensions 4.4.0 which is incompatible.
Installing collected packages: typing-extensions
  Attempting uninstall: typing-extensions
    Found existing installation: typing-extensions 4.7.1
    Uninstalling typing-extensions-4.7.1:
      Successfully uninstalled typing-extensions-4.7.1
Successfully installed typing-extensions-4.4.0

字符串
接下来,我想安装语言包python -m spacy download en,但发生了另一个错误:

(base) E:\Anaconda>python -m spacy download en
Traceback (most recent call last):
  File "E:\Anaconda\lib\site-packages\confection\__init__.py", line 38, in <module>
    from pydantic.v1 import BaseModel, Extra, ValidationError, create_model
  File "E:\Anaconda\lib\site-packages\pydantic\__init__.py", line 13, in <module>
    from . import dataclasses
  File "E:\Anaconda\lib\site-packages\pydantic\dataclasses.py", line 11, in <module>
    from ._internal import _config, _decorators, _typing_extra
  File "E:\Anaconda\lib\site-packages\pydantic\_internal\_config.py", line 9, in <module>
    from ..config import ConfigDict, ExtraValues, JsonEncoder, JsonSchemaExtraCallable
  File "E:\Anaconda\lib\site-packages\pydantic\config.py", line 9, in <module>
    from .deprecated.config import BaseConfig
  File "E:\Anaconda\lib\site-packages\pydantic\deprecated\config.py", line 6, in <module>
    from typing_extensions import Literal, deprecated
ImportError: cannot import name 'deprecated' from 'typing_extensions' (E:\Anaconda\lib\site-packages\typing_extensions.py)


我目前的python版本是3.7,我应该更新吗?或者有更好的解决方案?我是这方面的新手,谢谢大家!

kgqe7b3p

kgqe7b3p1#

你应该使用typing_extensions==4.7.1
尝试:

pip install typing_extensions==4.7.1 --upgrade

字符串
我还建议你将你的python版本从3.7升级到3.103.11
查看相关答案:
https://github.com/tiangolo/fastapi/discussions/9808

qybjjes1

qybjjes12#

我在colab上遇到了同样的错误,重新启动会话并运行!pip install -U pandas-profiling我可以解决这个错误。

相关问题