spyder中的IPython控制台在Anaconda中非常慢

2022-01-10 00:00:00 python spyder ipython anaconda

问题描述

在使用标准 python 安装/IDLE 几年后,我正在尝试 Anaconda/Spyder.在每个工作会话期间,控制台(和变量资源管理器)会随着我运行的每个脚本和交互式命令而逐渐变慢.最终,它需要几分钟才能得到对打印等简单命令的响应,然后它完全停止响应,我将其关闭.这对我的工作非常有干扰.

I'm trying Anaconda/Spyder after using the standard python installation/IDLE for several years. The console (and variable explorer) becomes progressively slower during each work session, with every script and interactive command that I run. Eventually it takes minutes to get a response to simple commands like print, and then it stops responding completely and I shut it down. It's pretty disruptive to my work.

Mac OSX 10.13.6

Mac OSX 10.13.6

conda version : 4.5.11
conda-build version : 3.15.1
python version : 3.7.0.final.0

qt 5.9.6
spyder 3.3.1 
ipython 7.1.1

我确实经常使用 matplotlib.只要有可能,我在脚本的开头使用 plt.ioff() 和/或在结尾使用 plt.close('all') .在首选项中完全关闭 matplotlib 支持无济于事,而且它也不是永久修复.Python 在我所有的 CPU 或 RAM 附近都没有使用.

I do use matplotlib frequently. Whenever possible I use plt.ioff() at the beginning of a script and/or plt.close('all') at the end. Turning off matplotlib support completely in preferences doesn't help and it's not a permanent fix anyway. Python is not using anywhere near all my CPU or RAM.


解决方案

所以这不是一个完全令人满意的解决方案,但它似乎是一个合理的临时解决方案.如果您将 spyder 版本降级到 3.1.X,您将能够使用 python 控制台而不是 Ipython 控制台,这似乎对我有用.为此,只需运行:

So this is not a totally satisfying solution but it seems to be a reasonable temporary fix. If you downgrade your spyder version to 3.1.X you will be able to use the python console rather than the Ipython console, and this seems to work for me. To do this just run:

conda install spyder=3.1

在您选择的环境处于活动状态时在终端中.这并不理想,因为开发人员出于特定原因删除了 python 控制台,如本问题所述,如何在 spyder 中添加 python 控制台.此外,降级这么多可能会对您的代码使用的其他包产生无法预料的影响,并可能导致其他问题,但到目前为止,这是我能够提出的唯一解决方案.

in the terminal while your environment of choice is active. This is not ideal, because the developers removed the python console for a specific reason as mentioned in this question, How to add python console in spyder. Additionally downgrading this much may have unforeseen effects on other packages your code uses and may cause other issues but so far this is the only solution I was able to come up with.

相关文章