從docker hub 下載了一個 tensorFlow(debian linux) 鏡像,但是里面只支持python2.7 kernel, 不支持python3 kernel.
1. Notebook的右上角點new 只看到 python 2.7 kernel, 然后run 下面命令也可以證實
[root@pydev pydev]# jupyter-kernelspec list Available kernels: python2 /usr/lib/python2.7/site-packages/ipykernel/resources
2. 那如何才能把python3 kernel 加進去呢?
1).首先看是否已經python3安裝,查了是有的
2). 然后看是否有Python3對應的pip3
python3 -m pip --version
發現沒有這個模塊
3. 因為官方的 tensforflow/tensorflow 鏡像是debian的,用下面命令下載pip3 (其他 linux 系統請自行 google 或者 baidu 參考其他相應文檔)
apt-get udpate
apt-get install python3-pip
4. 用pip3 安裝Python3 kernel
python3 -m pip install ipykernel python3 -m ipykernel install --user
5. done.
另:
Linux server上安裝配置 Jupyter 請看 linux端安裝Anaconda,方便遠端訪問jupyter
如果你的Linux server 在google cloud 上,請參考這里 教程 | 只需15分鍾,使用谷歌雲平台運行Jupyter Notebook
Jupyter 怎么遠程訪問?
不記得以前怎么配置的,但是記得就是改了一個配置就行了,結果這次配置好像安全加強了,下面是一個通過ssh通道連接的方法,總覺得直接在config 文件配置 ip='0.0.0.0' 不是更好嗎,但是確實試了過后發現不行.
參考這里 https://ambermd.org/tutorials/analysis/tutorial_notebooks/remote_notebook/index.html的解決方案
ssh -N -f -L localhost:8000:localhost:8000 your_account@your_cluster_address
Reference:
- centos 7 install jupyter notebook, https://jupyter.org/install
-
$python3 -m pip install --upgrade pip $python3 -m pip install jupyter
$jupyter notebook
-
- http://ipython.readthedocs.io/en/stable/install/kernel_install.html
- Centos 7 安裝 python3 (不要卸載python2 因為yum 要用) https://phoenixnap.com/kb/how-to-install-python-3-centos-7
- Centos 7 安裝python3 https://tecadmin.net/install-python-3-7-on-centos/
- Centos alternatives 控制多個版本的python https://linuxconfig.org/how-to-switch-between-python-versions-on-fedora-linux