为Jupyter notebook 增加内核,添加服务器已有的环境

参考与感谢:https://blog.csdn.net/wj1066/article/details/72891667

自己单独安装Jupyter时,默认的内核只有服务器系统的python3环境,但是很多其他的诸如tensorflow的包却在py2的目录下。

不用去重新建环境,直接添加已有环境即可。

jupyter 安装

pip3 install  -i https://pypi.tuna.tsinghua.edu.cn/simple jupyter --user

mkdir ~/.jupyter

jupyter notebook password

 

添加内核:

首先要安装ipykerner

pip install ipykernel --user

由于服务器多人在用,先看python2的目录在哪儿,

which python2

复制其所在的路径目录 /usr/bin/python

添加进去

/usr/bin/python -m ipykernel install --user --name py2

然后即可.其中python2的自定义的环境,命名为myPython2。重新打开jupyter notebook,便可看到

为Jupyter notebook 增加内核,添加服务器已有的环境