Spyder 中的 Ipython 控制台卡在“连接到内核”上
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27802860/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Ipython console in Spyder stuck on "connecting to kernel"
提问by YassineA
I am new to python and coming from Matlab and I have installed the latest version of Python(x,y) (2.7.9.0) on my Win 8 64 bit PC.
我是 Python 新手,来自 Matlab,我在 Win 8 64 位 PC 上安装了最新版本的 Python(x,y) (2.7.9.0)。
The problem that I have is that, each time I start Spyder, the default IPython console gets stuck on "connecting to kernel". I can see that a new kernel is launched each time because a new .json file appears in the directory ".ipython\profile_default\security". I can access this kernel by opening a new IPython console by clicking on "connect to an existing kernel" and then browsing to find it, then it works fine (except that the variables I create do not appear in the variable explorer). I can also quit the kernel from this new IPython console but this does not solve my problem because when I launch a new IPython console by clicking on "open an IPython console" or restarting Spyder, it still hangs on "connecting to kernel" and creates a new .json file.
我遇到的问题是,每次启动 Spyder 时,默认的 IPython 控制台都会卡在“连接到内核”上。我可以看到每次都会启动一个新内核,因为在目录“.ipython\profile_default\security”中出现了一个新的 .json 文件。我可以通过单击“连接到现有内核”打开一个新的 IPython 控制台来访问这个内核,然后浏览以找到它,然后它工作正常(除了我创建的变量没有出现在变量资源管理器中)。我也可以从这个新的 IPython 控制台退出内核,但这并不能解决我的问题,因为当我通过单击“打开 IPython 控制台”或重新启动 Spyder 启动一个新的 IPython 控制台时,它仍然挂在“连接到内核”并创建一个新的 .json 文件。
The closest issue that I could find on a forum is this one, the only difference being that I do not have the "import sitecustomize" error in the internal console. I have tried uninstalling Python(x,y) and python but to no avail. Any hint would be really appreciated.
最近的问题是我能找到的一个论坛,这是一个,唯一的区别是,我没有“进口sitecustomize”错误在内部控制台。我试过卸载 Python(x,y) 和 python 但无济于事。任何提示将不胜感激。
回答by bdanalytics
Removing /anaconda/lib/python2.7/site-packages from PYTHONPATH manager in Spyder solved this for me.
从 Spyder 的 PYTHONPATH 管理器中删除 /anaconda/lib/python2.7/site-packages 为我解决了这个问题。
回答by gustavgans
I run "Reset Spyder Settings" from the Windows Menu in the Anaconda section.
我从 Anaconda 部分的 Windows 菜单运行“重置 Spyder 设置”。
回答by Carlos Cordoba
Another possible solution to this problem is to update your pyzmqlibrary to version 14.6.0or higher, which should fix this problem in Windows 8.
此问题的另一个可能解决方案是将您的pyzmq库更新到版本14.6.0或更高版本,这应该可以在 Windows 8 中解决此问题。
If you are using Anaconda, you just need to do
如果您使用的是 Anaconda,则只需执行以下操作
conda update pyzmq
to do that.
要做到这一点。
回答by gerardus
Had the same issue. I closed the console window, then opened a new one (CTRL+T) and that fixed it. Problem didn't come back after a restart.
有同样的问题。我关闭了控制台窗口,然后打开了一个新窗口(CTRL+T)并修复了它。重启后问题没有出现。
回答by BenoitH
A very special thing happened to me, but it raised the same error ("connecting to kernel" freeze on Spyder): a '.' has accidentally slipped into my "pytable.py" file from pandas. Probably I opened it after an error and changed it / saved it accidentally.
一件非常特别的事情发生在我身上,但它引发了同样的错误(“连接到内核”在 Spyder 上冻结):一个 '.' 不小心从 Pandas 溜进了我的“pytable.py”文件。可能是我在出错后打开它并更改了它/不小心保存了它。
So, if you are using anaconda, check if by mistake a file in ...\Continuum\Anaconda\Lib\site-packages was changed ( sort file by date and see if a file was modified today for instance)
因此,如果您使用的是 anaconda,请检查是否错误地更改了 ...\Continuum\Anaconda\Lib\site-packages 中的文件(例如,按日期对文件进行排序并查看文件是否在今天被修改)
After fixing the changed file, everything is back to normal.
修复更改后的文件后,一切恢复正常。
回答by purushotam radadia
Try typing these 3 lines from the anaconda command prompt:
尝试从 anaconda 命令提示符键入以下 3 行:
conda create -n spyder python=2.7 spyder
conda create -n spyder python=2.7 spyder
activate spyder
激活间谍
spyder
间谍
回答by Abhishek K
Disabling anti-virus helped me resolve this issue instantly. Once the console was displayed, I enabled my anti-virus again.
禁用防病毒软件帮助我立即解决了这个问题。显示控制台后,我再次启用了防病毒软件。
回答by Richard Garner
Had the same problem. At first it couldn't find the kernel. Closing Consol and reopening did not work. However, what did work was closing Spyder
and then reopening. Note: I am running from python(x,y), not Anaconda.
有同样的问题。起初它找不到内核。关闭控制台并重新打开不起作用。但是,有效的是关闭Spyder
然后重新打开。注意:我从 python(x,y) 运行,而不是 Anaconda。
回答by meCHAoT
In my case I had to update the package ipykernelas well (on Python 3.6.3 | Anaconda 64-bit | Windows 10). Now my Spyder can spawn conoles in reasonable time.
就我而言,我还必须更新包ipykernel(在 Python 3.6.3 | Anaconda 64 位 | Windows 10 上)。现在,我的 Spyder 可以在合理的时间内生成控制台。
Using pip I succeeded by:
使用 pip 我成功了:
pip install -U pyzmq
pip install -U pyzmq
pip install -U ipykernel
pip install -U ipykernel
回答by s-jevtic
I had the same issue in Anaconda. I updated the spyder-kernels
module and it seems to work fine now.
我在 Anaconda 中遇到了同样的问题。我更新了spyder-kernels
模块,现在似乎工作正常。