简体   繁体   English

Jupyter notebook 的 Python 内核返回错误

[英]Jupyter notebook's Python kernel returns an error

I'm having trouble running python code on juypter notebook.我在 juypter 笔记本上运行 python 代码时遇到问题。 The following error message appears when I click on Kernel.单击 Kernel 时出现以下错误消息。 Does anyone have a clue of what's wrong?有没有人知道出了什么问题? Thanks in advance!提前致谢!

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/tornado/web.py", line 1704, in _execute
    result = await result
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/tornado/gen.py", line 769, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/notebook/services/sessions/handlers.py", line 69, in post
    model = yield maybe_future(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/tornado/gen.py", line 762, in run
    value = future.result()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/tornado/gen.py", line 769, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/notebook/services/sessions/sessionmanager.py", line 98, in create_session
    kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/tornado/gen.py", line 762, in run
    value = future.result()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/tornado/gen.py", line 769, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/notebook/services/sessions/sessionmanager.py", line 110, in start_kernel_for_session
    kernel_id = yield maybe_future(
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/tornado/gen.py", line 762, in run
    value = future.result()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/notebook/services/kernels/kernelmanager.py", line 176, in start_kernel
    kernel_id = await maybe_future(self.pinned_superclass.start_kernel(self, **kwargs))
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/jupyter_client/multikernelmanager.py", line 186, in start_kernel
    km.start_kernel(**kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/jupyter_client/manager.py", line 341, in start_kernel
    self.kernel = self._launch_kernel(kernel_cmd, **kw)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/jupyter_client/manager.py", line 249, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/jupyter_client/launcher.py", line 132, in launch_kernel
    proc = Popen(cmd, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 947, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 1819, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/Library/Frameworks/Python.framework/Versions/3.6/bin/python3'

Using this answer from another thread, I solved my issue.使用另一个线程的这个答案,我解决了我的问题。

I simply had to update jupyter notebook kernel using我只需要使用更新 jupyter notebook 内核

pip3 install ipykernel --upgrade
python3 -m ipykernel install --user

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

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