python
module_error
ai_generated
true
ModuleNotFoundError: 没有名为 'uvicorn' 的模块
ModuleNotFoundError: No module named 'uvicorn'
ID: python/starlette-no-module-named-uvicorn
80%修复率
90%置信度
0证据数
2024-01-30首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
FastAPI/Starlette 不内置 ASGI 服务器;当前环境中未安装 uvicorn。
English
FastAPI/Starlette does not bundle an ASGI server; uvicorn was never installed in the active environment.
解决方案
-
95% 成功率
Install server extra: pip install 'fastapi[standard]' # or: pip install uvicorn
-
85% 成功率
Verify the interpreter matches: which python && python -m uvicorn --version
无效尝试
常见但无效的做法:
-
80% 失败
fastapi does not depend on uvicorn by default.
-
85% 失败
The module import still fails before any server starts.