简体   繁体   中英

Matplotlib: 'module' object has no attribute 'FFMpegWriter' / 'Writer'

I'm trying to animate a graph with Matplotlib, something which I've done on a previous system. My code, however, seems to fail with my current setup.

Here's the problem:

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'

Or alternatively:

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'

I've just re-installed matplotlib (1.4.2) and ffmpeg (2.5.3) for good measure. I've also deleted all .pyc files from matplotlib's directory to make sure they aren't messing anything up.

I've looked around but been unable to find a solution. See also: Using FFmpeg and IPython , What could be wrong in saving the following animation in Python? .

Thanks in advance.

Turned out to be a stupid and simple problem. I was using pycharm (IDE) which was importing an outdated version of matplotlib from an incorrect directory (incidentally something I'm yet to fix). Thanks to tcaswell for prompting me to check where the module was imported from ( module.__file__ ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM