Jupyter笔记本电脑不运行任何命令

时间:2018-10-14 06:37:15

标签: python jupyter-notebook jupyter

我无法在jupyter Notebook中运行任何命令。

handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread
ERROR:tornado.application:Exception in callback (<zmq.sugar.socket.Socket object at 0x04378E70>, <function wrap.<locals>.null_wrapper at 0x0437CD68>)
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\tornado\ioloop.py", line 888, in start
    handler_func(fd_obj, events)
  File "c:\python27\lib\site-packages\tornado\stack_context.py", line 277, in null_wrapper
    return fn(*args, **kwargs)
  File "c:\python27\lib\site-packages\zmq\eventloop\zmqstream.py", line 450, in _handle_events
    self._handle_recv()
  File "c:\python27\lib\site-packages\zmq\eventloop\zmqstream.py", line 480, in _handle_recv
    self._run_callback(callback, msg)
  File "c:\python27\lib\site-packages\zmq\eventloop\zmqstream.py", line 432, in _run_callback
    callback(*args, **kwargs)
  File "c:\python27\lib\site-packages\tornado\stack_context.py", line 277, in null_wrapper
    return fn(*args, **kwargs)
  File "c:\python27\lib\site-packages\ipykernel\kernelbase.py", line 283, in dispatcher
    return self.dispatch_shell(stream, msg)
  File "c:\python27\lib\site-packages\ipykernel\kernelbase.py", line 233, in dispatch_shell
    self.pre_handler_hook()
  File "c:\python27\lib\site-packages\ipykernel\kernelbase.py", line 248, in pre_handler_hook
    self.saved_sigint_handler = signal(SIGINT, default_int_handler)
  File "c:\python27\lib\signal.py", line 47, in signal
    handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread
[I 10:57:51.456 NotebookApp] Kernel shutdown: fbbad76c-f291-476b-9307-f3789746cf4c

请考虑以下几点。

  1. 当我运行任何命令,例如简单的print('hello')时,单元将持续运行无限时间。

  2. 我使用

    安装了深色主题

    pip install jupyterthemes jt -t onedork

  3. 上面有错误,我将点数从18.0升级到18.1,然后将jupyter笔记本从4.3升级到4.4。

  4. 到昨天为止一切正常。

  5. 从早上开始,我遇到此问题,我尝试卸载并重新安装无法正常工作的jupyter笔记本,然后将pip从18.1降级到18.0,然后卸载并重新安装jupyter笔记本。但这没有用。

  6. 我使用jt -r将jupyter主题改回了原始主题,但没有解决办法。

  7. 昨天我也为我的Firefox添加了深色主题(深色阅读器)并将其禁用。但情况相同。

  8. 我再次重新安装了笔记本4.3版本并发出警告

    Requirement already satisfied: webencodings in c:\python27\lib\site-packages (from html5lib>=0.99999999->bleach->nbconvert->notebook==4.3) (0.5.1) widgetsnbextension 2.0.0 has requirement notebook>=4.4.1, but you'll have notebook 4.3.0 which is incompatible. jupyterthemes 0.19.6 has requirement notebook>=5.6.0, but you'll have notebook 4.3.0 which is incompatible. Installing collected packages: notebook Found existing installation: notebook 5.7.0 Uninstalling notebook-5.7.0: Successfully uninstalled notebook-5.7.0 Successfully installed notebook-4.3.0 You are using pip version 18.0, however version 18.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.

但没有任何效果。

  1. 我正在使用 Windows 10。 Python 3.6 点18.0 jupyter笔记本4.3.0

请帮助,如果需要其他信息,请告诉我。我试图搜索类似的问题,但无法找到解决方案。

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。首先,我检查了命令提示符日志。错误是:

<块引用>

ERROR:tornado.general:zmqstream 回调中未捕获的异常

以及对我有用的解决方案:

<块引用>

通过命令卸载goole-colab并升级ipykernel:

pip 卸载 google-colab

pip install --upgrade ipykernel

参考:Jupyter Notebook dead Kernel after Anaconda update