How Can I Save Animation.Artist animation?

て烟熏妆下的殇ゞ 提交于 2019-12-20 04:07:30

问题


I have a problem:

My program is working well but when I try to save the animation that I plot, The compiler responds with an error.

The Code:

import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import matplotlib.animation as animation

fig=plt.figure()
for infile in glob.glob('*.png'):
    img=mpimg.imread(infile)
    imgplot=plt.imshow(img)
    im_list2.append([imgplot])
ani = animation.ArtistAnimation(fig, im_list2, interval=50, blit=True)

But when I try to save it like this:

ani.save('Animation1.mp4')

It returns an error:

WindowsError: [Error 2] The system could not find the given data.


回答1:


I think you are with the same problem I had few days ago: here is the question I posted!

I solved my problem by changing line 163 from C:\Python27\Lib\site-packages\matplotlib\animation.py from

proc = Popen(command, shell=False, stdout=PIPE, stderr=PIPE)

to

proc = Popen(command, shell=True, stdout=PIPE, stderr=PIPE)

...However, I am not sure how "safe" is this change in the animation.py file! See more info here.



来源:https://stackoverflow.com/questions/9256829/how-can-i-save-animation-artist-animation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!