python install_error ai_generated true

AssertionError: 必须安装 `python-multipart` 库才能使用表单解析。

AssertionError: The `python-multipart` library must be installed to use form parsing.

ID: python/starlette-form-data-missing-python-multipart

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

版本兼容性

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

根因分析

FastAPI/Starlette 的表单处理需要 python-multipart,但该库未安装。

English

FastAPI/Starlette form handling requires python-multipart, which is not installed.

generic

解决方案

  1. 98% 成功率
    pip install python-multipart
  2. 95% 成功率
    echo 'python-multipart>=0.0.9' >> requirements.txt

无效尝试

常见但无效的做法:

  1. 85% 失败

    Form submissions are not JSON; parsing fails with a different error.

  2. 90% 失败

    The assertion fires before the handler runs.