sel*_*imb 9 python ffmpeg matplotlib
我是Python的新手(我使用MATLAB了很多).我本质上希望能够制作和保存动画.所以我去检查它是如何完成的并找到了这个:http: //jakevdp.github.io/blog/2012/08/18/matplotlib-animation-tutorial/
我直接在IPython Notebook中复制/粘贴了代码.
我知道必须安装ffmpeg,我以为我做了(根据http://www.wikihow.com/Install-FFmpeg-on-Windows).路径是C:/ ffmpeg.当我在命令提示符中尝试ffmpeg -version时,它确实有效.它也适用于WinPython的命令提示符.我不知道它是否有帮助,但Ipython的路径是:C:\ Users\Sal\WinPython-32bit-3.3.2.3\python-3.3.2\Scripts /
但是,它仍然无效.给出的错误是:AttributeError:'str'对象没有属性'save'当然,这个错误发生在.save命令中.我甚至试图添加下面的内容.什么都不做.writer ='ffmpeg'
我使用的是Windows 7,WinPython3.3.
非常感谢你
Sas*_*cha 19
我遇到完全相同的错误,因为我开始使用完全相同的示例开始使用动画.首先,
我使用的是Windows 7,Python 2.7.6,matplotlib 1.3.1
简短回答:尝试自己设置FFMpegWriter
mywriter = animation.FFMpegWriter()
anim.save('mymovie.mp4',writer=mywriter)
Run Code Online (Sandbox Code Playgroud)
龙答:我肯定是有错误的matplotblib.animation.save
有以下行
if is_string_like(writer):
Run Code Online (Sandbox Code Playgroud)
捕获用户定义的编写器实际上不是编写器函数而只是其名称的情况.然后,如果该编写器可用,它会实例化该编写器的实例
if writer in writers.avail:
writer = writers[writer](fps, codec, bitrate,
extra_args=extra_args,
metadata=metadata
Run Code Online (Sandbox Code Playgroud)
但是,如果用户定义的编写器不在其中,writers.avail那么这就是错误
writer = writers.list()[0]
Run Code Online (Sandbox Code Playgroud)
它本身返回一个字符串,其中包含要使用的writer 的名称.但是,这个字符串无法用于实际创建一个编写器对象!
| 归档时间: |
|
| 查看次数: |
13759 次 |
| 最近记录: |