uncategorized

Jupyter Notebook

Basic

指定端口运行

1
> jupyter notebook --port portnum(9999)

指定启动目录

1
> jupyter notebook --notebook-dir dir_path

开启Notebook,不默认打开browser

1
> jupyter notebook --no-browser

HELP

1
> jupyter notebook --help

jupyter_contrib_nbextensions

运行计时

1
2
3
4
> python -m pip install jupyter_contrib_nbextensions 
> python -m jupyter contrib nbextension install --user
# jupyter nbextension enable/disable <nbextension require path>
> jupyter nbextension enable execute_time/ExecuteTime

Jupyter Nbextensions Configurator

1
2
> python -m pip install jupyter_nbextensions_configurator
> python -m jupyter nbextensions_configurator enable --user

开启notedown插件

1
2
> pip install https://github.com/mli/notedown/tarball/master
> jupyter notebook --NotebookApp.contents_manager_class='notedown.NotedownContentsManager'

默认开启notedown

1
2
3
4
5
# 生成jupyter配置文件
> jupyter notebook --generate-config
# 配置文件目录
> vi ~/.jupyter/jupyter_notebook_config.py
> c.NotebookApp.contents_manager_class = 'notedown.NotedownContentsManager'

访问远程server运行的Jupyter

1
2
3
4
5
6
# localhost指的是myserver,因为目标主机是相对myserver而言的
> ssh myserver -L 8008(local port):localhost:8888(server port) -l(username) username

# The first option -N tells SSH that no remote commands will be executed, and is useful for port forwarding.
# The second option -f Requests ssh to go to background just before command execution.
> ssh -N -f -L localhost:8888:localhost:8889 remote_user@remote_host
Share