如何解决“Jupyter笔记本内核错误”?

2024-10-01 19:25:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试在我的机器上运行jupyter笔记本。我完成了安装octave和scilab内核的步骤,因为除了Python之外,我还需要这些内核。当我试图创建或打开笔记本时,由于内核错误,我无法执行任何代码

Screenshot of notebook with kernel error

笔记本中的错误日志如下所示:

    Traceback (most recent call last):
  File "C:\Users\bthlin009\AppData\Roaming\Python\Python38\site-packages\tornado\web.py", line 1704, in _execute
    result = await result
  File "C:\Users\bthlin009\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 769, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "c:\users\bthlin009\appdata\local\programs\python\python38\lib\site-packages\notebook\services\sessions\handlers.py", line 69, in post
    model = yield maybe_future(
  File "C:\Users\bthlin009\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 762, in run
    value = future.result()
  File "C:\Users\bthlin009\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 769, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "c:\users\bthlin009\appdata\local\programs\python\python38\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 88, in create_session
    kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
  File "C:\Users\bthlin009\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 762, in run
    value = future.result()
  File "C:\Users\bthlin009\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 769, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "c:\users\bthlin009\appdata\local\programs\python\python38\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 100, in start_kernel_for_session
    kernel_id = yield maybe_future(
  File "C:\Users\bthlin009\AppData\Roaming\Python\Python38\site-packages\tornado\gen.py", line 762, in run
    value = future.result()
  File "c:\users\bthlin009\appdata\local\programs\python\python38\lib\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 "C:\Users\bthlin009\AppData\Roaming\Python\Python38\site-packages\jupyter_client\multikernelmanager.py", line 185, in start_kernel
    km.start_kernel(**kwargs)
  File "C:\Users\bthlin009\AppData\Roaming\Python\Python38\site-packages\jupyter_client\manager.py", line 309, in start_kernel
    kernel_cmd, kw = self.pre_start_kernel(**kw)
  File "C:\Users\bthlin009\AppData\Roaming\Python\Python38\site-packages\jupyter_client\manager.py", line 258, in pre_start_kernel
    self.write_connection_file()
  File "C:\Users\bthlin009\AppData\Roaming\Python\Python38\site-packages\jupyter_client\connect.py", line 468, in write_connection_file
    self.connection_file, cfg = write_connection_file(self.connection_file,
  File "C:\Users\bthlin009\AppData\Roaming\Python\Python38\site-packages\jupyter_client\connect.py", line 138, in write_connection_file
    with secure_write(fname) as f:
  File "c:\users\bthlin009\appdata\local\programs\python\python38\lib\contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "C:\Users\bthlin009\AppData\Roaming\Python\Python38\site-packages\jupyter_core\paths.py", line 461, in secure_write
    win32_restrict_file_to_user(fname)
  File "C:\Users\bthlin009\AppData\Roaming\Python\Python38\site-packages\jupyter_core\paths.py", line 387, in win32_restrict_file_to_user
    import win32api
ImportError: DLL load failed while importing win32api: %1 is not a valid Win32 application.

我已尝试重新安装内核,并已将octave和scilab可执行文件的目录添加到系统变量中。我已经检查了python可执行文件的路径是python38

我还需要做什么来解决这个问题


Tags: inpyselfpackageslinesitekernelstart

热门问题