简体   繁体   English

使用 Jupyter notebook 时出现内核错误

[英]Kernal error while using Jupyter notebook

I have been using jupyter notebook for a pretty long period but today there was a kernel error while loading jupyter notebook.我已经使用 jupyter notebook 很长时间了,但今天加载 jupyter notebook 时出现内核错误。 I am using python 3.9.5 and I already have win32api.我正在使用 python 3.9.5 并且我已经有了 win32api。

I have tried installing "pip install pypiwin32==225"我试过安装“pip install pypiwin32==225”

Traceback (most recent call last):
  File "C:\Users\smutyapu\lib\site-packages\tornado\web.py", line 1704, in _execute
    result = await result
  File "C:\Users\smutyapu\lib\site-packages\tornado\gen.py", line 769, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "C:\Users\smutyapu\AppData\Roaming\Python\Python39\site-packages\notebook\services\sessions\handlers.py", line 69, in post
    model = yield maybe_future(
  File "C:\Users\smutyapu\lib\site-packages\tornado\gen.py", line 762, in run
    value = future.result()
  File "C:\Users\smutyapu\lib\site-packages\tornado\gen.py", line 769, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "C:\Users\smutyapu\AppData\Roaming\Python\Python39\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 "C:\Users\smutyapu\lib\site-packages\tornado\gen.py", line 762, in run
    value = future.result()
  File "C:\Users\smutyapu\lib\site-packages\tornado\gen.py", line 769, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "C:\Users\smutyapu\AppData\Roaming\Python\Python39\site-packages\notebook\services\sessions\sessionmanager.py", line 110, in start_kernel_for_session
    kernel_id = yield maybe_future(
  File "C:\Users\smutyapu\lib\site-packages\tornado\gen.py", line 762, in run
    value = future.result()
  File "C:\Users\smutyapu\AppData\Roaming\Python\Python39\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\smutyapu\lib\site-packages\jupyter_client\multikernelmanager.py", line 186, in start_kernel
    km.start_kernel(**kwargs)
  File "C:\Users\smutyapu\lib\site-packages\jupyter_client\manager.py", line 337, in start_kernel
    kernel_cmd, kw = self.pre_start_kernel(**kw)
  File "C:\Users\smutyapu\lib\site-packages\jupyter_client\manager.py", line 286, in pre_start_kernel
    self.write_connection_file()
  File "C:\Users\smutyapu\lib\site-packages\jupyter_client\connect.py", line 466, in write_connection_file
    self.connection_file, cfg = write_connection_file(self.connection_file,
  File "C:\Users\smutyapu\lib\site-packages\jupyter_client\connect.py", line 136, in write_connection_file
    with secure_write(fname) as f:
  File "C:\Users\smutyapu\lib\contextlib.py", line 117, in __enter__
    return next(self.gen)
  File "C:\Users\smutyapu\lib\site-packages\jupyter_core\paths.py", line 461, in secure_write
    win32_restrict_file_to_user(fname)
  File "C:\Users\smutyapu\lib\site-packages\jupyter_core\paths.py", line 387, in win32_restrict_file_to_user
    import win32api
ImportError: DLL load failed while importing win32api: The specified module could not be found.

Any suggestion or help would be appreciable.任何建议或帮助将是可观的。

Just copy 2 files from C:\\Python39\\Lib\\site-packages\\pywin32_system32只需从 C:\\Python39\\Lib\\site-packages\\pywin32_system32 复制 2 个文件

to C:\\Windows\\System32, it works.到 C:\\Windows\\System32,它可以工作。

The two files are pythoncom38.dll and pywintypes38.dll.这两个文件是 pythoncom38.dll 和 pywintypes38.dll。

Credits : Sujay and here's a Reference.致谢:Sujay 和这里的参考。

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

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