python install_error ai_generated true

ImportError: 未安装 email-validator,请运行 `pip install pydantic[email]`

ImportError: email-validator is not installed, run `pip install pydantic[email]`

ID: python/fastapi-email-validator-missing

其他格式: JSON · Markdown 中文 · English
80%修复率
90%置信度
0证据数
2024-03-27首次发现

版本兼容性

版本状态引入弃用备注
3.x active — — —

根因分析

模型使用了 pydantic 的 EmailStr,但未安装可选的 email-validator 依赖。

English

A model uses pydantic EmailStr but the optional email-validator dependency is not installed.

generic

解决方案

  1. 95% 成功率
    Install the extra:
    pip install 'pydantic[email]'
  2. 90% 成功率
    Add email-validator to requirements and rebuild the image.

无效尝试

常见但无效的做法:

  1. 60% 失败

    Removes validation; invalid emails pass through.

  2. 85% 失败

    Base pydantic does not bundle email-validator.