python
system_error
ai_generated
true
FileNotFoundError: [Errno 2] 没有这样的文件或目录: 'ffmpeg'
FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'
ID: python/matplotlib-animation-ffmpeg-missing
80%修复率
89%置信度
0证据数
2024-07-08首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.x | active | — | — | — |
根因分析
matplotlib.animation.FuncAnimation.save() 默认使用 ffmpeg 写入器,但 ffmpeg 不在 PATH 中。
English
matplotlib.animation.FuncAnimation.save() defaults to ffmpeg writer, but ffmpeg is not on PATH.
解决方案
-
95% 成功率
sudo apt-get install -y ffmpeg # or: conda install -c conda-forge ffmpeg
-
90% 成功率
from matplotlib.animation import PillowWriter ani.save('anim.gif', writer=PillowWriter(fps=20))
无效尝试
常见但无效的做法:
-
92% 失败
The PyPI 'ffmpeg' package is a Python wrapper; it does not provide the ffmpeg binary.
-
90% 失败
The writer is already ffmpeg; the binary is what's missing.