Jupyter 同時支持python二、python3 kernel

從docker hub 下載了一個 tensorFlow(debian linux) 鏡像,可是裏面只支持python2.7 kernel, 不支持python3 kernel.html

1. Notebook的右上角點new 只看到 python 2.7 kernel, 而後run 下面命令也能夠證明python

[root@pydev pydev]# jupyter-kernelspec list Available kernels: python2 /usr/lib/python2.7/site-packages/ipykernel/resources

 

2. 那如何才能把python3 kernel 加進去呢?linux

1).首先看是否已經python3安裝,查了是有的docker

2). 而後看是否有Python3對應的pip3centos

python3 -m pip --version

發現沒有這個模塊安全

 

3. 由於官方的 tensforflow/tensorflow 鏡像是debian的,用下面命令下載pip3 (其餘 linux 系統請自行 google 或者 baidu 參考其餘相應文檔)python2.7

 apt-get udpate
 apt
-get install python3-pip

 

4. 用pip3 安裝Python3 kernelssh

python3 -m pip install ipykernel python3 -m ipykernel install --user

 

5. done.ui

  

 

 

另:google

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:

  1. centos 7 install jupyter notebook, https://jupyter.org/install
    1.   
      $python3 -m pip install --upgrade pip $python3 -m pip install jupyter
      $jupyter notebook

       

  2. http://ipython.readthedocs.io/en/stable/install/kernel_install.html
  3. Centos 7 安裝 python3 (不要卸載python2 由於yum 要用) https://phoenixnap.com/kb/how-to-install-python-3-centos-7
  4. Centos 7 安裝python3 https://tecadmin.net/install-python-3-7-on-centos/
  5. Centos alternatives 控制多個版本的python https://linuxconfig.org/how-to-switch-between-python-versions-on-fedora-linux
相關文章
相關標籤/搜索