Python Jupyter 笔记本未运行代码。卡在 [*]

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46383177/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 17:35:21  来源:igfitidea点击:

Jupyter notebook not running code. Stuck on In [*]

pythonjupyter-notebookjupyter

提问by tedd

My code was running fine before I did not change anything and I ran it again. Now it doesn't return anything not even an error. It is just stuck on "In [*]".

在我没有改变任何东西之前我的代码运行良好,我再次运行它。现在它不返回任何东西,甚至不返回错误。它只是停留在“In [*]”上。

See problem visually here

在这里直观地看到问题

回答by SioSMac

This means that Jupyter is still running the kernel. It is possible that you are running an infinite loop within the kernel and that is why it can't complete the execution.

这意味着 Jupyter 仍在运行内核。您可能正在内核中运行无限循环,这就是它无法完成执行的原因。

Try manually stopping the kernel by pressing the stop button at the top. If that doesn't work, interrupt it and restart it by going to the "Kernel" menu. This should disconnect it.

尝试按顶部的停止按钮手动停止内核。如果这不起作用,请中断它并通过转到“内核”菜单重新启动它。这应该断开它。

Otherwise, I would recommend closing and reopening the notebook. The problem may also be with your code.

否则,我建议关闭并重新打开笔记本。问题也可能与您的代码有关。

回答by Afshin Amiri

I have installed jupyter with command pip3 install jupyterand have the same problem. when instead I used the command pip3 install jupyter ipythonthe problem was fixed.

我已经用命令安装了 jupyterpip3 install jupyter并且遇到了同样的问题。当我使用命令时pip3 install jupyter ipython,问题得到了解决。

回答by Itachi

updating ipykernel did it for me. it seems arch linux's ipykernel package had been outdated for some time

更新 ipykernel 为我做到了。似乎 arch linux 的 ipykernel 包已经过时了一段时间

just do pip install --upgrade ipykernel

做就是了 pip install --upgrade ipykernel

reference here: github solution

参考这里:github解决方案

回答by Anand Kumar

enter image description here

在此处输入图片说明

This is mean your program is still running in background, you need to click shutdown (Shown in attached Image).

这意味着您的程序仍在后台运行,您需要单击关闭(如附图所示)。

*** Shutdown the Running cell and again run your program.

*** 关闭正在运行的单元格并再次运行您的程序。

回答by Goatie

What I did was to quit the Notebook, and I started all over again. That is the proper solution. Restarting the Kernel really did not really help. But quitting did so try quitting and start again

我所做的是退出 Notebook,然后我重新开始。这才是正确的解决方案。重新启动内核真的没有帮助。但是戒烟确实如此尝试戒烟并重新开始

回答by Filip

The answers that state that your kernel is still executing the code in the cell are correct. You can see that by the small circle in the top right. If it is filled with a black/grey color, then it means it is still running.

表明您的内核仍在执行单元格中代码的答案是正确的。您可以通过右上角的小圆圈看到这一点。如果它以黑色/灰色填充,则表示它仍在运行。

I just want to add that I experienced a problem in JupyterHub where the code in the cell would just not execute. I stopped and restarted the kernel, shutdown and reloaded the notebook, but it still did not run.

我只想补充一点,我在 JupyterHub 中遇到了一个问题,即单元格中的代码无法执行。我停止并重新启动内核,关闭并重新加载笔记本,但它仍然没有运行。

What worked for me was literally copy pasting the same code to a new cell and deleting the old one. It then ran from the new cell.

对我有用的是将相同的代码复制粘贴到新单元格并删除旧单元格。然后它从新单元格运行。

回答by gherson

Check the output on the server environment from which jupyter notebookwas launched if you can. You'll probably find error messages and print()results.

jupyter notebook如果可以,请检查从中启动的服务器环境的输出。您可能会发现错误消息和print()结果。

回答by user13101981

I fixed this issue

我解决了这个问题

just only type this command: jupyter notebook --no-browser

只需输入以下命令: jupyter notebook --no-browser

It will show you the path then copy and paste on Jupyter Notebook browser

它将显示路径,然后在 Jupyter Notebook 浏览器上复制并粘贴

The code will be executed in IPython Notebook Python 3

代码将在 IPython Notebook Python 3 中执行

回答by user13335777

I have the same issue and I did this: I went to windows option (the icon), then I chose the option Anaconda Prompt then a small windows show up with the prompt like this: c:\user\computer name> then I type this: c:\user\computer name>jupyter notebook
then enter and that's it. I hope that helps

我有同样的问题,我这样做了:我去了 windows 选项(图标),然后我选择了选项 Anaconda Prompt 然后一个小窗口出现,提示如下:c:\user\computer name> 然后我输入这个: c:\user\computer name>jupyter notebook
然后输入,就是这样。我希望有帮助