Jupyter笔记本显示FileNotFoundError,无法运行任何shell



我已经安装了Jupyter:

OS:32位windows 7

jupyter笔记本的版本是6.0.1。

安装后,当我试图打开笔记本电脑时,它显示了一个内核错误:

Traceback (most recent call last):
File "E:Jupyterminiconda3libsite-packagestornadoweb.py", line 1703, in _execute
result = await result
File "E:Jupyterminiconda3libsite-packagestornadogen.py", line 742, in run
yielded = self.gen.throw(*exc_info)  # type: ignore
File "E:Jupyterminiconda3libsite-packagesnotebookservicessessionshandlers.py", line 72, in post
type=mtype))
File "E:Jupyterminiconda3libsite-packagestornadogen.py", line 735, in run
value = future.result()
File "E:Jupyterminiconda3libsite-packagestornadogen.py", line 742, in run
yielded = self.gen.throw(*exc_info)  # type: ignore
File "E:Jupyterminiconda3libsite-packagesnotebookservicessessionssessionmanager.py", line 88, in create_session
kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
File "E:Jupyterminiconda3libsite-packagestornadogen.py", line 735, in run
value = future.result()
File "E:Jupyterminiconda3libsite-packagestornadogen.py", line 742, in run
yielded = self.gen.throw(*exc_info)  # type: ignore
File "E:Jupyterminiconda3libsite-packagesnotebookservicessessionssessionmanager.py", line 101, in start_kernel_for_session
self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
File "E:Jupyterminiconda3libsite-packagestornadogen.py", line 735, in run
value = future.result()
File "E:Jupyterminiconda3libsite-packagestornadogen.py", line 209, in wrapper
yielded = next(result)
File "E:Jupyterminiconda3libsite-packagesnotebookserviceskernelskernelmanager.py", line 168, in start_kernel
super(MappingKernelManager, self).start_kernel(**kwargs)
File "E:Jupyterminiconda3libsite-packagesjupyter_clientmultikernelmanager.py", line 110, in start_kernel
km.start_kernel(**kwargs)
File "E:Jupyterminiconda3libsite-packagesjupyter_clientmanager.py", line 259, in start_kernel
**kw)
File "E:Jupyterminiconda3libsite-packagesjupyter_clientmanager.py", line 204, in _launch_kernel
return launch_kernel(kernel_cmd, **kw)
File "E:Jupyterminiconda3libsite-packagesjupyter_clientlauncher.py", line 138, in launch_kernel
proc = Popen(cmd, **kwargs)
File "E:Jupyterminiconda3libsubprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "E:Jupyterminiconda3libsubprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

正因为如此,我不能用Jupyter来运行任何东西。如何修复?

这是您的环境中的一个问题。以下是调试方法:

检查Jupyter配置中指定的内核(请参阅Linux上的%APPDATA%jupyterkernels<kernel_name>kernel.json/~/.local/share/jupyter/kernels/<kernel_name>/kernel.json(是否可以通过命令行启动。

例如,在我的kernel.json文件中,有:

{
"argv": [
"/home/mrmino/.virtualenvs/taf/bin/python3.7",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "Python 3",
"language": "python"
}

因此,在我的系统上,命令/home/mrmino/.virtualenvs/taf/bin/python3.7 -m ipykernel_launcher应该启动ipython内核。

如果在您的服务器上没有,则必须在JSON内核spec文件中安装或手动更正它。

试试这个,它对我有用。

python3 -m ipykernel install --user

参考:https://github.com/jupyter/notebook/issues/2563

最新更新