Python Jupyter Notebook无法运行代码-不断重新连接

时间:2018-09-19 02:15:33

标签: python jupyter-notebook

我搜索了其他帖子,但似乎找不到满足我的Jupyter Notebook问题的答案。笔记本可以正常启动,但会继续重新连接内核,并且不会执行任何代码块。我只是在左边的括号中有一个星星,它甚至不执行简单的打印语句。这是从jupyter笔记本客户端输出的:

[W 22:08:13.025 NotebookApp] Terminals not available (error was No module 
named 'winpty.cywinpty')
[I 22:08:13.027 NotebookApp] Serving notebooks from local directory: 
C:\Users\rsq2_\Downloads\RSQTest\venv\Scripts
[I 22:08:13.028 NotebookApp] The Jupyter Notebook is running at:
[I 22:08:13.028 NotebookApp] http://localhost:9999/? 
token=9777b5132d5ad6e00ddb64f3f6d4f8ca3a705f90ad515d7b
[I 22:08:13.028 NotebookApp] Use Control-C to stop this server and shut down 
all kernels (twice to skip confirmation).
[C 22:08:13.071 NotebookApp]

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
    http://localhost:9999/? 
token=9777b5132d5ad6e00ddb64f3f6d4f8ca3a705f90ad515d7b
[I 22:08:13.189 NotebookApp] Accepting one-time-token-authenticated 
connection from ::1
[I 22:08:17.765 NotebookApp] Creating new notebook in
[I 22:08:19.113 NotebookApp] Kernel started: 610a6f8c-bf7f-45bc-9025- 
70896e912238
[I 22:08:20.386 NotebookApp] Adapting to protocol v5.1 for kernel 610a6f8c- 
bf7f-45bc-9025-70896e912238
[I 22:08:20.400 NotebookApp] Starting buffering for 610a6f8c-bf7f-45bc-9025- 
70896e912238:69e5000561cf4ee6b54b9cc8e508446f
[I 22:08:21.420 NotebookApp] Adapting to protocol v5.1 for kernel 610a6f8c- 
bf7f-45bc-9025-70896e912238
[I 22:08:21.423 NotebookApp] Restoring connection for 610a6f8c-bf7f-45bc- 
9025-70896e912238:69e5000561cf4ee6b54b9cc8e508446f
[I 22:08:21.434 NotebookApp] Starting buffering for 610a6f8c-bf7f-45bc-9025- 
70896e912238:69e5000561cf4ee6b54b9cc8e508446f
[I 22:08:22.472 NotebookApp] Adapting to protocol v5.1 for kernel 610a6f8c- 
bf7f-45bc-9025-70896e912238
[I 22:08:22.476 NotebookApp] Restoring connection for 610a6f8c-bf7f-45bc- 
9025-70896e912238:69e5000561cf4ee6b54b9cc8e508446f
[I 22:08:24.316 NotebookApp] Starting buffering for 610a6f8c-bf7f-45bc-9025- 
70896e912238:69e5000561cf4ee6b54b9cc8e508446f
[I 22:08:25.382 NotebookApp] Adapting to protocol v5.1 for kernel 610a6f8c- 
bf7f-45bc-9025-70896e912238
[I 22:08:25.386 NotebookApp] Restoring connection for 610a6f8c-bf7f-45bc- 
9025-70896e912238:69e5000561cf4ee6b54b9cc8e508446f
[I 22:08:25.389 NotebookApp] Starting buffering for 610a6f8c-bf7f-45bc-9025- 
70896e912238:69e5000561cf4ee6b54b9cc8e508446f
[I 22:08:26.424 NotebookApp] Adapting to protocol v5.1 for kernel 610a6f8c- 
bf7f-45bc-9025-70896e912238
[I 22:08:26.428 NotebookApp] Restoring connection for 610a6f8c-bf7f-45bc- 
9025-70896e912238:69e5000561cf4ee6b54b9cc8e508446f

我看到它说“终端不可用”,但不确定如何解决。我目前正在通过视频课程学习Python,建议使用jupyter笔记本。因此,我没有背景知道如何解决此问题。谢谢您的帮助!我正在运行Win10 64位。

编辑:根本不要求输入密码,是的,我第一次使用令牌登录。一切正常,并创建了新的Python3笔记本文件。但是一旦进入笔记本,它就不会运行任何代码行。我按下shift + enter来执行该单元格,它只是将我带到下一个空白单元格而没有执行任何操作。

enter image description here

enter image description here

enter image description here

3 个答案:

答案 0 :(得分:0)

我有一个类似的问题。进入Anaconda-> Environments并在那里更新ipython和ipkernel模块似乎为我解决了这个问题。

答案 1 :(得分:0)

尝试降级您的Tornado版本。当conda将Tornado升级到6.0时,我遇到了类似的问题,即单元无法执行。

$ conda install tornado=5.1.1

Tornado 5.7.5尚未在conda仓库中提供。

答案 2 :(得分:0)

如果在反向代理(nginx)后面设置了jupyter,请参考此处的答案。 这对我有用:jupyter notebook keeps reconnecting