我有个问题:
我的程序运行良好,但是当我尝试保存绘制的动画时,编译器响应错误。
代码:
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)
但是当我尝试像这样保存它时:
ani.save('Animation1.mp4')
它返回一个错误:
WindowsError:[错误2]系统找不到给定的数据。
我想你和我几天前遇到的问题是一样的:here https://stackoverflow.com/questions/9213554/matplotlib-animation-error-the-system-cannot-find-the-file-specified是我发布的问题!
我通过将 C:\Python27\Lib\site-packages\matplotlib\animation.py 中的第 163 行更改为
proc = Popen(command, shell=False, stdout=PIPE, stderr=PIPE)
to
proc = Popen(command, shell=True, stdout=PIPE, stderr=PIPE)
...但是,我不确定animation.py 文件中的此更改有多“安全”!在这里查看更多信息 http://docs.python.org/library/subprocess.html#frequently-used-arguments.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)