Jupyter Notebook配置,一篇就夠

原由

每次更換電腦或者要新建一個Jupyter Notebook環境,都要查找好幾個網站,去配置好開發環境,記錄一下全部配置,之後就不用頻繁使用搜索引擎,卻只爲了尋找幾句配置。html

簡介

Jupyter Notebook是個開源的Web應用,能夠建立包含代碼、公式、可視化及敘事文本的共享文檔;git

  • 支持超過40種編程語言
  • 可共享的notebook
  • 交互式的輸出
  • 集成大數據工具

配置

1. 生成配置文件

jupyter notebook --generate-config
複製代碼

2. 設置密碼

jupyter notebook password
複製代碼

3. 修改配置文件

vim ~/.jupyter/jupyter_notebook_config.py
修改如下三個節點的配置,並把開頭的 # 註釋去掉
c.NotebookApp.ip = '*' # 開啓全部的IP訪問,便可使用遠程訪問
c.NotebookApp.open_browser = False # 關閉啓動後的自動開啓瀏覽器
c.NotebookApp.port = 8888  # 設置端口8888,也可用其餘的,好比1080,8080等等
複製代碼

4. 啓動notebook

jupyter notebook
複製代碼

5. 遠程訪問

在瀏覽器輸入http://hostip:8888,hostip能夠是本地地址,局域網地址,也能夠是遠程服務器地址(好比阿里雲或者AWS或者其餘雲服務器廠商的VPS外網地址)。github

6. 主題

pip install jupyterthemes
 # list available themes
# onedork | grade3 | oceans16 | chesterish | monokai | solarizedl | solarizedd
jt -l
 # select theme...
jt -t chesterish
複製代碼

詳細步驟還能夠查看該工程的github主頁:github.com/dunovank/ju…shell

Reference

  1. jupyter.readthedocs.io/en/latest/p…
  2. github.com/dunovank/ju…

原文連接:c1rew.github.io/2019/05/12/…編程

相關文章
相關標籤/搜索