Jupyter因卸载重装导致的问题修复

因为一些原因,卸载了Anaconda2的版本,转向3..发现Jupyter挂了.百思不得其解.后来了解到是因为内核找不到的问题导致的.这里整理了一下处理办法

错误内容:

Traceback (most recent call last):
  File "c:\program files\python36\lib\site-packages\tornado\web.py", line 1543, in _execute
    result = yield result
  File "c:\program files\python36\lib\site-packages\tornado\gen.py", line 1099, in run
    value = future.result()
  File "c:\program files\python36\lib\site-packages\tornado\gen.py", line 1107, in run
    yielded = self.gen.throw(*exc_info)
  File "c:\program files\python36\lib\site-packages\notebook\services\sessions\handlers.py", line 73, in post
    type=mtype))
  File "c:\program files\python36\lib\site-packages\tornado\gen.py", line 1099, in run
    value = future.result()
  File "c:\program files\python36\lib\site-packages\tornado\gen.py", line 1107, in run
    yielded = self.gen.throw(*exc_info)
  File "c:\program files\python36\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 79, in create_session
    kernel_id = yield self.start_kernel_for_session(session_id, path, name, type, kernel_name)
  File "c:\program files\python36\lib\site-packages\tornado\gen.py", line 1099, in run
    value = future.result()
  File "c:\program files\python36\lib\site-packages\tornado\gen.py", line 1107, in run
    yielded = self.gen.throw(*exc_info)
  File "c:\program files\python36\lib\site-packages\notebook\services\sessions\sessionmanager.py", line 92, in start_kernel_for_session
    self.kernel_manager.start_kernel(path=kernel_path, kernel_name=kernel_name)
  File "c:\program files\python36\lib\site-packages\tornado\gen.py", line 1099, in run
    value = future.result()
  File "c:\program files\python36\lib\site-packages\tornado\gen.py", line 315, in wrapper
    yielded = next(result)
  File "c:\program files\python36\lib\site-packages\notebook\services\kernels\kernelmanager.py", line 148, in start_kernel
    super(MappingKernelManager, self).start_kernel(**kwargs)
  File "c:\program files\python36\lib\site-packages\jupyter_client\multikernelmanager.py", line 110, in start_kernel
    km.start_kernel(**kwargs)
  File "c:\program files\python36\lib\site-packages\jupyter_client\manager.py", line 259, in start_kernel
    **kw)
  File "c:\program files\python36\lib\site-packages\jupyter_client\manager.py", line 204, in _launch_kernel
    return launch_kernel(kernel_cmd, **kw)
  File "c:\program files\python36\lib\site-packages\jupyter_client\launcher.py", line 128, in launch_kernel
    proc = Popen(cmd, **kwargs)
  File "c:\program files\python36\lib\subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "c:\program files\python36\lib\subprocess.py", line 997, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

解决办法

  1. 首先使用jupyter kernelspec list查看安装的内核和位置
    2.进入安装内核目录打开kernel.jason文件,查看Python编译器的路径是否正确(其实笔者的问题就是因为路径不正确导致的),修改错误的这个配置.
    3.重启jupyter notebook即可

网络上一些其他解决办法

1.首先使用jupyter kernelspec list查看安装的内核和位置
2.进入安装内核目录打开kernel.jason文件,查看Python编译器的路径是否正确
如果不正确python -m ipykernel install --user重新安装内核,如果有多个内核,如果你使用conda create -n python2 python=2,为Python2.7设置conda变量,那么在anacoda下使用activate pyhton2切换python环境,重新使用python -m ipykernel install --user安装内核
3.重启jupyter notebook即可

你可能感兴趣的:(python,python)