# UserWarning: FigureCanvasAgg 是非交互式的，因此无法显示

- **ID:** `python/matplotlib-no-display-figure`
- **领域:** python
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

在 matplotlib 使用非交互后端 (Agg) 时调用了 plt.show()，通常发生在无头环境或调用了 matplotlib.use('Agg') 之后。

## 版本兼容性

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

## 解决方案

1. **** (97% 成功率)
   ```
   fig, ax = plt.subplots()
ax.plot([1,2,3])
fig.savefig('plot.png', dpi=150)
   ```
2. **** (82% 成功率)
   ```
   pip install PyQt5
import matplotlib
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
plt.plot([1,2,3]); plt.show()
   ```

## 无效尝试

- **** — The block argument only controls blocking behavior for interactive backends; Agg still cannot render a window. (90% 失败率)
- **** — The backend selection is environment-driven, not an installation defect. (85% 失败率)
