【已解决】jupyter各包之间不匹配的诸多问题

前一天用jupyter忘记关闭服务直接关机了,第二天出现了如下问题:

Error executing Jupyter command 'notebook': [Errno 2] No such file or directory

于是开始了漫长的修复环境之路。
1、卸载jupyter的所有包

jupyter
jupyter-client
jupyter-console 
jupyter-core 

卸载完成之后重新安装上述包。注意只用pip uninstall不行,需要把

/PlayGround/anaconda3/envs/py352/lib/python3.5/site-packages

下jupyter相关的包删除。
2、重装完jupyter后,由于版本不对应,此时主要是与nbconvert包版本不对应。此时jupyter服务可以打开,但是进行操作时会出现如下错误:

500 : Internal Server Error

此时可以选择从新安装nbconvert。
3、但是重装nbconvert会导致与

ipython

版本不对应。从而出现以下错误

ImportError: cannot import name 'create_prompt_application' 

继续卸载重装ipython。
4、又会导致与

ipykernel

版本不对应,从而一直导致jupyter后台一直重启kernel:

jupyter KernelRestarter: restarting kernel (1/5), new random ports

最终重装ipykernel,问题done!

总结:
一开始只是想省事简单pip以下,没有考虑包之间的依赖关系,结果却绕远了。如果各位想重装的时候,最快捷的方法是:全部卸载,删除文件夹再安装如下包:

ipykernel
ipython
jupyter
jupyter-client
jupyter-core
jupyter-console

发布了55 篇原创文章 · 获赞 238 · 访问量 21万+

猜你喜欢

转载自blog.csdn.net/zkp_987/article/details/104797159
今日推荐