Jupyter Notebook出现kernel error
当时用Anaconda安装多个版本的Python的时候,时常由于安装和卸载多次Python导致Juoyter notebook不可用。常常导致如下结果
File”//anaconda/lib/python2.7/site-packages/jupyter_client/manager.py”, line 190, in _launch_kernel
return launch_kernel(kernel_cmd, **kw)
File “//anaconda/lib/python2.7/site-packages/jupyter_client/launcher.py”, line 123, in launch_kernel
proc = Popen(cmd, **kwargs)
File “//anaconda/lib/python2.7/subprocess.py”, line 710, in init
errread, errwrite)
File “//anaconda/lib/python2.7/subprocess.py”, line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or director
解决办法
- 运行
python -m ipykernel install --user
重新安装内核 - 如果有多个内核,先运行
conda create -n python2 python=2
,为Python2.7设置Anaconda变量,在Anacoda下使用activate pyhton2
切换python环境 - 重启jupyter notebook即可
小技巧
jupyter kernelspec list
查看安装的内核和位置
进入安装内核目录打开kernel.jason
文件,查看Python编译器的路径