Spyder Python动画无效

时间:2017-01-23 21:51:51

标签: python animation matplotlib spyder

我正在使用来自anaconda的spyder处理python项目,我正在努力让动画功能正常工作。

我在这里找到了一个基本动画示例:http://matplotlib.org/1.4.1/examples/animation/basic_example.html 并试图让它发挥作用。

然而,当我运行它时,Python和iPython控制台都没有任何反应。

我找到了这个答案:Animation from matplotlib not working in spyder但是,更改首选项不起作用,输入%matplotlib qt返回:没有名为qt4的模块。

Spyder版本:3.1.0 在MacOS Sierra上运行

2 个答案:

答案 0 :(得分:1)

你需要运行

%matplotlib qt5

在运行动画之前,而不是

%matplotlib qt

因为这只适用于Qt4。

答案 1 :(得分:0)

感谢大家的回答。我发现了我的错误,就是我忘了将.py添加到文件名中,因此Spyder没有将它们识别为python文件。