python
install_error
ai_generated
true
RuntimeError: 表单数据需要安装"python-multipart"。
RuntimeError: Form data requires "python-multipart" to be installed.
ID: python/fastapi-form-data-requires-python-multipart
80%修复率
90%置信度
0证据数
2024-02-22首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 0.100.x | active | — | — | — |
| 0.110.x | active | — | — | — |
根因分析
使用Form(...)或File(...)但未安装python-multipart包。
English
Using Form(...) or File(...) without the python-multipart package installed.
解决方案
-
99% 成功率
pip install python-multipart
-
97% 成功率
echo 'python-multipart>=0.0.9' >> requirements.txt
无效尝试
常见但无效的做法:
-
70% 失败
If the client sends form-encoded data, FastAPI still needs multipart to parse it.
-
90% 失败
Wrong package name; FastAPI imports python_multipart.