简体   繁体   English

无法在某些 Jupyiter ipython 笔记本单元格中执行代码

[英]Cannot execute code in some of Jupyiter ipython notebook cells

Any cells in Jupyter which have In [*] in front of them are not executing in Jupyter notebook. Jupyter 中任何前面有In [*]的单元格都不会在 Jupyter 笔记本中执行。 See image below:见下图:

在此处输入图像描述

I even restarted the kernel, without any improvement of the situation.我什至重新启动了内核,但情况没有任何改善。 Previous cells run without trouble.以前的单元格运行没有问题。 Every cell I added recently has the problem.我最近添加的每个单元格都有问题。

I recommend you the following steps:我建议您执行以下步骤:

  1. Close ipython notebook, and then reopen the file.关闭 ipython 笔记本,然后重新打开该文件。
  2. If 1 does not work, then restart the kernel and reopen the file.如果 1 不起作用,则重新启动内核并重新打开文件。
  3. If 2 does not work, then try whether things work fine on console.如果 2 不起作用,请尝试在控制台上是否正常。 Type ipython and check whether your code statements work.键入ipython并检查您的代码语句是否有效。
  4. If 3 does not work, try reinstalling the scientific python distribution if you are using Anaconda or Enthought.如果 3 不起作用,如果您使用的是 Anaconda 或 Enthought,请尝试重新安装科学 python 发行版。

I have encountered same problem on my windows machine.Try Jupyter with Anaconda on Windows will not run cells .我在我的 Windows 机器上遇到了同样的问题。 在 Windows 上尝试使用 Anaconda 的 Jupyter 不会运行单元格 Probably your antivirus program or your iis is blocking default 8888 port.可能您的防病毒程序或您的 iis 阻止了默认的 8888 端口。

Downgrading tornado to 4.5.3 fixed my problem.将龙卷风降级到 4.5.3 解决了我的问题。 with

pip - sudo python3.6 -m pip install tornado==4.5.3
conda - conda install tornado==4.5.3

use this for this bugs将此用于此错误

This happened to me just a few days ago.就在几天前,这发生在我身上。 If you look closely, you can see the in[*] before the code cell.如果仔细观察,您可以在代码单元格之前看到in[*] This means that it's busy.这意味着它很忙。 Try restarting the kernel again, or close and reopen jupyter notebook.再次尝试重新启动内核,或关闭并重新打开 jupyter notebook。 If the issue still persists, it has something to do with the previous cells (the code in previous cells might take too long to run causing those cells to be busy).如果问题仍然存在,则可能与之前的单元格有关(之前单元格中的代码可能运行时间过长导致这些单元格忙碌)。

You probably have a lot of notebooks(tabs) open with running kernels in them.您可能打开了很多笔记本(标签),其中运行着内核。 You can check this by clicking on this icon 1 on the left.您可以通过单击左侧的此图标1进行检查。 There you see all the running kernels in all your open notebooks and shut them down.在那里,您可以在所有打开的笔记本中看到所有正在运行的内核,然后将它们关闭。 2 This should solve your problem. 2这应该可以解决您的问题。

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

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