IPython Notebook 中的 [*] 是什么意思以及如何关闭它?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30421373/
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
What does In [*] in IPython Notebook mean and how to turn it off?
提问by Isak La Fleur
I use Windows 7, Python 2.7.9 plus latest version of IPython 3.1.
我使用 Windows 7、Python 2.7.9 以及最新版本的 IPython 3.1。
I ran %python
inside an IPython Notebook and ran the cell, instead of returning the Python version, it did not run and jumped to a new line and printed a In [*]
instead of a line number. Now no line is running in ipython everything is ignored when I try to run a cell value.
我%python
在 IPython Notebook 中运行并运行单元格,而不是返回 Python 版本,它没有运行并跳转到一个新行并打印一个In [*]
而不是行号。现在 ipython 中没有运行任何行,当我尝试运行单元格值时,所有内容都被忽略。
Anyone know what has happen?
有谁知道发生了什么?
采纳答案by Mike Müller
The kernel is busy. Go to the menu Kernel
and click Interrupt
. If this does not work click Restart
. You need to go in a new cell and press Shift + Enter
to see if it worked.
内核很忙。转到菜单Kernel
并单击Interrupt
。如果这不起作用,请单击Restart
。您需要进入一个新的单元格并按下Shift + Enter
以查看它是否有效。
回答by Chirag
For me to resolve this issue, I had to stop my anti-virus program.
为了解决这个问题,我不得不停止我的防病毒程序。
回答by Elle
The issue causing your kernel to be busy can be a specific line of code. If that is the case, your computer may just need time to work through that line.
导致内核繁忙的问题可能是特定的代码行。如果是这种情况,您的计算机可能只需要时间来处理该线路。
To find out which line or lines are taking so long, as mentioned by Mike Muller you need to restart the program or interrupt the kernel. Then go through carefully running one line at a time until you reach the first one with the asterisk.
要找出哪一行或多行花费了这么长时间,正如 Mike Muller 所提到的,您需要重新启动程序或中断内核。然后仔细地一次一行地运行,直到到达带有星号的第一行。
If you do not restart or interrupt your busy program, you will not be able to tell which line is the problem line and which line is not, because it will just stay busy while it works on that problem line. It will continue to give you the asterisk on every line until it finishes running that one line of code even if you start back at the beginning. This is extremely confusing, because lines that have run and produced output suddenly lose their output when you run them on the second pass. Also confusing is the fact that you can make changes to your code while the kernel is busy, but you just can't get any new output until it is free again.
如果您不重新启动或中断繁忙的程序,您将无法分辨哪一行是问题行,哪一行不是,因为它在该问题行上工作时只会保持忙碌。它会继续在每一行上给你星号,直到它完成运行那一行代码,即使你从头开始。这非常令人困惑,因为当您在第二遍运行它们时,已经运行并产生输出的行突然丢失了它们的输出。同样令人困惑的是,您可以在内核繁忙时更改代码,但在它再次空闲之前您无法获得任何新输出。
Your code does not have to be wrong to cause this. You may just have included a time-consuming command. Bootstrapping has caused this for me.
您的代码不一定是错误的。您可能只是包含了一个耗时的命令。引导对我造成了这种情况。
If your code is what it needs to be, it doesn't actually matter which line is the problem line, and you just need to give all of your code time to run. The main reasons to find out which is the problem line would be if some lines were expendable, or in case you were getting the asterisk for some other reason and needed to rule this one out.
如果您的代码是它需要的样子,那么哪一行是问题行实际上并不重要,您只需要给所有代码运行时间。找出问题行的主要原因是,如果某些行是可消耗的,或者如果您因其他原因得到星号并且需要排除这个问题。
If you are writing code on an internet service that times out when you aren't giving it input, your code might not have enough time to finish running if you just wait on it. Scrolling every few minutes is usually enough to keep those pages from timing out.
如果您在 Internet 服务上编写代码,但在您未提供输入时超时,那么如果您只是等待它,您的代码可能没有足够的时间来完成运行。每隔几分钟滚动一次通常足以防止这些页面超时。