# 模块未找到错误：没有名为 'pydantic_settings' 的模块

- **ID:** `python/fastapi-missing-dependency`
- **领域:** python
- **类别:** module_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

FastAPI 应用依赖 pydantic-settings 库，但未安装。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (100% 成功率)
   ```
   pip install pydantic-settings
   ```
2. **** (60% 成功率)
   ```
   from pydantic import BaseSettings 但需要 pydantic v1，或降级
   ```

## 无效尝试

- **** — pydantic 本身不包含 BaseSettings，需要额外安装。 (80% 失败率)
- **** — 已安装 pydantic 但缺少 pydantic-settings。 (70% 失败率)
