无法在Jupyter Notebook上启动内核 [英] Failed to start the kernel on jupyter notebook

查看:798
本文介绍了无法在Jupyter Notebook上启动内核的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过Homebrew安装了python版本3.6.5_13.7.0.
jupyter需要python 3.6来启动.如果我切换到python 3.7,它将无法启动.

I have python versions 3.6.5_1 and 3.7.0installed via Homebrew.
jupyter needs python3.6 for launching. It wouldn't start if I switch to python3.7.

启动后,它无法启动内核.出现此错误:

After launching, it fails to start the kernel. Giving this error:

Traceback (most recent call last):
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/web.py", line 1543, in _execute
result = yield result
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
value = future.result()
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run
yielded = self.gen.throw(*exc_info)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/notebook/services/sessions/handlers.py", line 73, in post
type=mtype))
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
value = future.result()
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run
yielded = self.gen.throw(*exc_info)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 79, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
value = future.result()
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1107, in run
yielded = self.gen.throw(*exc_info)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/notebook/services/sessions/sessionmanager.py", line 92, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 1099, in run
value = future.result()
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/vendor/lib/python3.6/site-packages/tornado/gen.py", line 315, in wrapper
yielded = next(result)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/notebook/services/kernels/kernelmanager.py", line 148, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/jupyter_client/multikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/jupyter_client/manager.py", line 259, in start_kernel
**kw)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/jupyter_client/manager.py", line 204, in _launch_kernel
return launch_kernel(kernel_cmd, **kw)
File "/usr/local/Cellar/jupyter/1.0.0_4/libexec/lib/python3.6/site-packages/jupyter_client/launcher.py", line 128, in launch_kernel
proc = Popen(cmd, **kwargs)
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/subprocess.py", line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/opt/python/bin/python3.7': '/usr/local/opt/python/bin/python3.7'

据我了解,内核正在寻找python 3.7.我的内核列表只有python3

From what I understand, the kernel is looking for python3.7. My kernel list has just python3

$jupyter kernelspec list  
Available kernels:  
python3    /usr/local/etc/jupyter/kernels/python3  

我查看了 github上的此链接,但这没有帮助.如何使jupyter和内核运行在相同的python版本上?

I looked at this link on github, but it wasn't helpful. How do I make jupyter and the kernel running on the same python version?

推荐答案

检查内核规范:

$jupyter kernelspec list

这将向您显示可用的内核.在这种情况下:

This will show you the available kernels. In this case:

python3    /usr/local/etc/jupyter/kernels/python3  

在此目录中打开kernel.json文件,并在argv键中指定要内核使用的python路径.

Open the kernel.json file in this directory and specify the path of python you want the kernel to use in the argv key.

这篇关于无法在Jupyter Notebook上启动内核的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆