-
安装
conda install jupyter notebook -
生成配置文件
jupyter notebook --generate-config
会在当前目录下生成配置文件.jupyter/jupyter_notebook_config.py -
修改配置文件
- 常规修改
c.NotebookApp.allow_remote_access = True
c.NotebookApp.ip = ‘*’
c.NotebookApp.notebook_dir = ‘/path/’
c.NotebookApp.open_browser = False
c.NotebookApp.port = 9999
- 修改为密码方式
-
生成密码
- 生成密码方式1
jupyter notebook password
Enter password: #键入密码,不显示的
Verify password: #再次重复键入密码
Wrote hashed password to .jupyter\jupyter_notebook_config.json #密码生成的一串sha1,写入到了这个文件,等下要把这串sha1,复制到第一个生成的配置文件中 - 生成密码方式2
进入python运行界面
from notebook.auth import passwd
passwd()
Enter password:
Verify password:
Out[2]: ‘sha1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx’
- 生成密码方式1
-
修改jupyter_notebook_config.py
-
NotebookApp.allow_password_change=False
c.NotebookApp.password = u'sha1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
-
启动服务
配置文件目录下
方式1:jupyter notebook --allow-root
方式2:nohup jupyter notebook --config=jupyter_notebook_config.py > log.out 2>&1 & -
转为后台运行
方式1启动用这个步骤
ctrl + z 放到后台,并且处于暂停状态,不可执行
jobs 查看任务的PID
bg + pid 变成继续执行
使用ctrl+d 中断回话,最后关闭窗口
方式2启动不用这个步骤 -
notebook常用一些快捷键,不区分大小写
切换编辑模式和命令模式
在编辑模式中,左边粗框线是绿色的,你能在单元格中看到一个光标。
在命令模式中,左边粗框线是蓝色的。
ESC
切换到命令模式(命令模式相当于视图模式,不是命令行)
A
在当前单元格上方创建一个单元格
B
在当前单元格下方创建一个单元格
L
打开/关闭行号
DD
删除当前单元格
S
手动保存笔记本
command
+shift
+P
调出命令行,适用于谷歌个safari
H
查询命令行命令
Y
从markdown切换到单元格
M
从单元格却换到markdown