Jupyter Notebook簡明指南
阿新 • • 發佈:2018-12-22
文章目錄
1. 安裝
python 3(推薦)
python3 -m pip install --upgrade pip
python3 -m pip install jupyter
python 2
python -m pip install --upgrade pip
python -m pip install jupyter
virtual environment
pip install --upgrade pip
pip install jupyter
2. 執行
2.1 基本執行命令
點選這裡,檢視官方指南。
2.2 在伺服器上執行
設定為伺服器的IP地址,並指定埠號
jupyter notebook --ip xxx.xxx.xxx.xxx --port xxxx
例如,伺服器使用的IP為 172.16.2.233,指定埠號為 8888
jupyter notebook --ip 172.16.2.233 --port 8888
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://172.16.2.233:8888/?token=277edfd3b1dd827a4641b0901f4b6eecedb0e861729a620d
2.3 設定預設配置
2.3.1生成配置檔案
jupyter notebook --generate-config
配置檔案路徑為:
~/.jupyter/jupyter_notebook_config.py
2.3.2 生成金鑰
代開 python shell
from notebook.auth import passwd
passwd()
Enter password:
Verify password:
'sha1:feb73cb5561d:ebb2959943c9392da717ee22934da7514f3a441d'
************
2.3.3 修改配置檔案
vim ~/.jupyter/jupyter_notebook_config.py
c.NotebookApp.ip='*' # 設定所有ip皆可訪問,或者伺服器IP地址
c.NotebookApp.password = u'sha1:feb73cb5561d:ebb2959943c9392da717ee22934da7514f3a441d' # 剛才複製的那個密文'
c.NotebookApp.open_browser = False # 禁止自動開啟瀏覽器
c.NotebookApp.port = 8888 # 指定埠