如何解决Jupyter Notebook“无法启动内核”中的问题

时间:2019-10-31 00:41:33

标签: python jupyter-notebook kernel

当尝试使用python版本3.7.4启动jupyter笔记本时,我遇到以下错误:

无法启动内核消息是...

Traceback (most recent call last):
  File "C:\Users\felixkim1023\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\web.py", line 1699, in _execute
    result = await result
  File "C:\Users\felixkim1023\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "C:\Users\felixkim1023\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\handlers.py", line 72, in post
    type=mtype))
  File "C:\Users\felixkim1023\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "C:\Users\felixkim1023\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "C:\Users\felixkim1023\AppData\Local\Continuum\anaconda3\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\felixkim1023\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "C:\Users\felixkim1023\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 742, in run
    yielded = self.gen.throw(*exc_info)  # type: ignore
  File "C:\Users\felixkim1023\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 101, in start_kernel_for_session
    self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
  File "C:\Users\felixkim1023\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 735, in run
    value = future.result()
  File "C:\Users\felixkim1023\AppData\Local\Continuum\anaconda3\lib\site-packages\tornado\gen.py", line 209, in wrapper
    yielded = next(result)
  File "C:\Users\felixkim1023\AppData\Local\Continuum\anaconda3\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 168, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "C:\Users\felixkim1023\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
    km.start_kernel(**kwargs)
  File "C:\Users\felixkim1023\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\manager.py", line 240, in start_kernel
    self.write_connection_file()
  File "C:\Users\felixkim1023\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\connect.py", line 547, in write_connection_file
    kernel_name=self.kernel_name
  File "C:\Users\felixkim1023\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\connect.py", line 212, in write_connection_file
    with secure_write(fname) as f:
  File "C:\Users\felixkim1023\AppData\Local\Continuum\anaconda3\lib\contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "C:\Users\felixkim1023\AppData\Local\Continuum\anaconda3\lib\site-packages\jupyter_client\connect.py", line 102, in secure_write
    with os.fdopen(os.open(fname, open_flag, 0o600), mode) as f:
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\felixkim1023\\AppData\\Roaming\\jupyter\\runtime\\kernel-0a76fc02-0376-4747-a88f-0effa941a976.json'

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

PermissionError: [Errno 13] Permission denied: 'C:\\Users\\felixkim1023\\AppData\\Roaming\\jupyter\\runtime\\kernel-0a76fc02-0376-4747-a88f-0effa941a976.json'

这句话很清楚,您没有权限。如果您使用的是bash shell,请确保使用sudo运行命令,即:

sudo jupyter notebook

如果您不是(例如,您在Windows Powershell中),请确保以管理员身份启动Shell(右键单击以管理员身份启动)。