# 运行时错误：此 Python 版本中 asyncio.run() 不可用

- **ID:** `python/asyncio-runner-not-available`
- **领域:** python
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

在 Python 3.6 或更早版本中使用 asyncio.run()，该函数在 Python 3.7 中引入。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.6 | active | — | — |
| 3.7 | active | — | — |

## 解决方案

1. **Use asyncio.get_event_loop().run_until_complete() on a new loop** (85% 成功率)
   ```
   loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
loop.run_until_complete(main())
   ```
2. **Upgrade Python to 3.7+** (95% 成功率)
   ```
   python3 --version  # ensure >= 3.7
   ```

## 无效尝试

- **Using asyncio.get_event_loop().run_until_complete() without checking loop status** — If the loop is already running, this may cause 'Event loop is already running' error. (60% 失败率)
- **Upgrading Python but not updating code** — The error is version-specific; upgrading Python resolves it but code may need adjustments. (30% 失败率)
