Matplotlib:'模块'对象没有属性' FFMpegWriter' /'作家'

时间:2015-02-15 23:21:12

标签: python animation matplotlib ffmpeg

我正在尝试使用Matplotlib为图形设置动画,这是我在之前的系统上完成的。但是,我的代码似乎因我当前的设置而失败。

问题在于:

Writer = animation.writers['ffmpeg']
  

追踪(最近一次通话):     文件“/Users/oliversanders/Documents/Code/PyCharm/plottools/animationTest.py”,第17行,in       Writer = animation.writers ['ffmpeg']   AttributeError:'module'对象没有属性'writers'

或者:

mywriter = animation.FFMpegWriter(fps=15)
  

追踪(最近一次通话):     文件“/Users/oliversanders/Documents/Code/PyCharm/plottools/animatedPointPlotter.py”,第101行,       mywriter = animation.FFMpegWriter(fps = 15)   AttributeError:'module'对象没有属性'FFMpegWriter'

我刚刚重新安装了matplotlib(1.4.2)和ffmpeg(2.5.3)。我还删除了matplotlib目录下的所有.pyc文件,以确保它们没有搞乱任何内容。

我环顾四周但无法找到解决方案。也可以看看: Using FFmpeg and IPythonWhat could be wrong in saving the following animation in Python?

提前致谢。

1 个答案:

答案 0 :(得分:2)

原来是一个愚蠢而简单的问题。我正在使用pycharm(IDE)从一个不正确的目录导入过时的matplotlib版本(顺便提一下我还没有修复)。感谢tcaswell提示我检查模块的导入位置(module.__file__)。