use*_*737 4 python pydantic prefect
我目前正在使用 prefect 在 python 中编排一些简单的任务。它工作正常,直到我收到此错误:
Traceback (most recent call last):
File "test.py", line 2, in <module>
from prefect import flow
File "/Users/.../.venv/lib/python3.8/site-packages/prefect/__init__.py", line 25, in <module>
from prefect.states import State
...
ImportError: cannot import name 'SecretField' from 'pydantic' (/Users/.../.venv/lib/python3.8/site-packages/pydantic/__init__.py)
Run Code Online (Sandbox Code Playgroud)
看来我已经在我的 venv 中安装了模块:
(.venv) User@user % pip show pydantic
Name: pydantic
Version: 2.3.0
Summary: Data validation using Python type hints
Home-page: None
Author: None
Author-email: Samuel Colvin <s@muelcolvin.com>, Eric Jolibois <em.jolibois@gmail.com>, Hasan Ramezani <hasan.r67@gmail.com>, Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com>, Terrence Dorsey <terry@pydantic.dev>, David Montague <david@pydantic.dev>
License: None
Location: /Users.../.venv/lib/python3.8/site-packages
Requires: annotated-types, pydantic-core, typing-extensions
Required-by: prefect, fastapi
Run Code Online (Sandbox Code Playgroud)
这可能来自哪里?
Tim*_*ess 10
那是因为 Perfect 尚不兼容pydantic>2。
因此,他们将要求固定在小于 2 的版本上(查看PR10144了解更多详细信息)。
尝试安装latestPerfect 版本或将 pydantic 降级为1.10.11:
pip install -U perfect
# or pip install pydantic==1.10.11
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2109 次 |
| 最近记录: |