# OSError: [Errno 98] 地址已被占用

- **ID:** `python/starlette-uvicorn-address-in-use`
- **领域:** python
- **类别:** system_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

另一个进程（通常是之前的 uvicorn 重载进程）已占用该主机/端口。

## 版本兼容性

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

## 解决方案

1. **** (92% 成功率)
   ```
   Find and kill the holder:
lsof -i :8000
kill -9 <PID>
   ```
2. **** (90% 成功率)
   ```
   Run on a different port:
uvicorn app:app --port 8001
   ```

## 无效尝试

- **** — Reload doesn't free the port; it spawns another process that fails to bind. (85% 失败率)
- **** — More workers compete for the same port and worsen the conflict. (90% 失败率)
