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

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

## 根因

之前的服务器进程仍占用该端口（如 uvicorn --reload 遗留僵尸进程，或其他应用占用 8000）。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 0.30+ | active | — | — |

## 解决方案

1. **** (97% 成功率)
   ```
   lsof -i :8000 | awk 'NR>1{print $2}' | xargs kill -9
# Windows:
netstat -ano | findstr :8000
   ```
2. **** (95% 成功率)
   ```
   uvicorn main:app --port 8001
   ```

## 无效尝试

- **** — Zombie process survives terminal close. (60% 失败率)
- **** — uvicorn already sets it; a live listener still blocks. (90% 失败率)
