python - Matplotlib: 'module'对象没有属性 'FFMpegWriter'/'Writer'

标签 python animation matplotlib ffmpeg

我正在尝试使用 Matplotlib 制作图形动画,这是我在以前的系统上做过的事情。然而,我的代码在我当前的设置下似乎失败了。

问题是这样的:

Writer = animation.writers['ffmpeg']

Traceback (most recent call last): File "/Users/oliversanders/Documents/Code/PyCharm/plottools/animationTest.py", line 17, in Writer = animation.writers['ffmpeg'] AttributeError: 'module' object has no attribute 'writers'

或者:

mywriter = animation.FFMpegWriter(fps=15)

Traceback (most recent call last): File "/Users/oliversanders/Documents/Code/PyCharm/plottools/animatedPointPlotter.py", line 101, in mywriter = animation.FFMpegWriter(fps=15) AttributeError: 'module' object has no attribute 'FFMpegWriter'

我刚刚重新安装了 matplotlib (1.4.2) 和 ffmpeg (2.5.3) 以达到良好的效果。我还从 matplotlib 目录中删除了所有 .pyc 文件,以确保它们不会弄乱任何东西。

我环顾四周,但找不到解决方案。也可以看看: Using FFmpeg and IPython , What could be wrong in saving the following animation in Python? .

提前致谢。

最佳答案

结果证明这是一个愚蠢而简单的问题。我正在使用 pycharm (IDE),它从不正确的目录导入过时版本的 matplotlib(顺便说一句,我还没有修复)。感谢 tcaswell 提示我检查模块是从哪里导入的 (module.__file__)。

关于python - Matplotlib: 'module'对象没有属性 'FFMpegWriter'/'Writer',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28532431/

相关文章:

java - 将 View 平移到屏幕边界之外并将其动画回来

html - 显示变化中断过渡

python - "pip install matplotlib": "“python setup.py egg_info” failed with error code 1"while installing matplotlib

python - 使用 matplotlib 的 3D 曲面图,使用数据框列输入数据

python - 从依赖于交互式 map 的表中抓取数据

python - 如何在 Python 中进行 "if run from ipython"测试?

python - argv 的 ctypes 错误

javascript - 如何独立于刷新率计时 requestAnimationFrame()

python - Matplotlib:给Figure.add_subplot()的3位参数的含义是什么?

javascript - 无法从 Django 项目中的 Angular 路由加载模板