本人jupyter notebook是在python3.5的基础上安装的,但实际中有一个包is only for python2,于是必须切换jupyter notebook的kernel为python2.7
经查,只需一句话:sudo pip2 install ipykernel
但是报错:ERROR: Cannot uninstall 'ipython'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
如下图:
注意到ipython版本必须大于等于4.0.0,且当前版本为2.4.1,自然想着卸载旧版本,安装新版本~但百度搜索“卸载ipython ”关键词竟然没有方法,于是自创:sudo pip2 uninstall ipython,失败
既然卸载不了旧的,索性也就不管了,直接安装新的(版本大于4.0.0):sudo pip2 install ipython==5.3.0
依然卸载不了,旧版本2.4.1始终坚挺~~~~~
卸不了就升级,不必纠结旧版本:sudo -H pip2 install --ignore-installed -U ipython
显示成功:
那么就用之前查的一句话切换kernel:sudo pip2 install ipykernel,成功,见下图:
版本为4.10.0,总之能大于4.0.0了,安装后,执行以下命令:
python2.7 -m ipykernel install --user
这样就把python 2也加入到Jupyter的kernel里面了
在工程里,点击kernel——change kernel——python2就大功告成了!