简体   繁体   English

Spyder Python 动画不起作用

[英]Spyder Python Animation not working

I'm working on a python project using spyder from anaconda and I am trying to get the animation function working.我正在使用 anaconda 的 spyder 处理一个 python 项目,我正在尝试使动画功能正常工作。

I found a basic animation example here: http://matplotlib.org/1.4.1/examples/animation/basic_example.html and tried to make it work.我在这里找到了一个基本的动画示例: http : //matplotlib.org/1.4.1/examples/animation/basic_example.html并试图让它工作。

However when I run it, nothing happens both in the Python and iPython console.但是,当我运行它时,Python 和 iPython 控制台中都没有任何反应。

I found this answer: Animation from matplotlib not working in spyder However, changing the preferences does not do anything and typing in %matplotlib qt returns: No module named qt4.我找到了这个答案: 来自 matplotlib 的动画在 spyder 中不起作用但是,更改首选项并没有做任何事情并且输入 %matplotlib qt 返回:No module named qt4。

Spyder Version: 3.1.0 Running on MacOS Sierra Spyder 版本:3.1.0 在 MacOS Sierra 上运行

You need to run你需要跑

%matplotlib qt5

before running the animation, instead of在运行动画之前,而不是

%matplotlib qt

because that only works for Qt4.因为这只适用于 Qt4。

Thanks everyone for the answers.谢谢大家的回答。 I found out my error, it was that I forgot to add .py to the file name so Spyder did not recognise them as python files.我发现了我的错误,是我忘记将 .py 添加到文件名中,因此 Spyder 无法将它们识别为 python 文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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