J'ai un code très simple de l'exemple matplotlib:"IOError: [Errno 32] Broken pipe" lors de l'enregistrement des fichiers d'animation en python anaconda
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
fig, ax = plt.subplots()
line, = ax.plot(np.random.rand(10))
ax.set_ylim(0, 1)
def update(data):
line.set_ydata(data)
return line,
def data_gen():
while True: yield np.random.rand(10)
ani = animation.FuncAnimation(fig, update, data_gen, interval=1000)
anim.save('basic_animation.mp4', fps=30)
plt.show()
Tout est juste si je ne l'utilise pas anim.save () fonction. Cependant, quand je veux l'enregistrer, il signalerait:
IOError Traceback (most recent call last)
<ipython-input-6-8948bc3b3f5c> in <module>()
16
17 ani = animation.FuncAnimation(fig, update, data_gen, interval=1000)
---> 18 anim.save('basic_animation.mp4', fps=30)
19 plt.show()
....(traceback details are omitted here)
/home/xin/anaconda2/lib/python2.7/site-packages/matplotlib/backends/backend_agg.pyc in print_raw(self, filename_or_obj, *args, **kwargs)
517 close = False
518 try:
--> 519 fileobj.write(renderer._renderer.buffer_rgba())
520 finally:
521 if close:
IOError: [Errno 32] Broken pipe
Comment puis-je résoudre ce problème? Ou existe-t-il d'autres moyens de sauvegarder l'animation dans un fichier?
Supplément: Pour installer ffmpeg, je viens de lancer: Conda installer -c https://conda.anaconda.org/mutirri ffmpeg
Merci, mais il signaler toujours le même problème ..... Je pense que ce pourrait être quelque chose de mal avec mon cadre, puisque je copie l'exemple exact de http://matplotlib.org/examples/animation/ basic_example.html mais toujours le même rapport ... –