notebook安装与配置
安装
pip install notebook
直接安装可能会失败,使用清华镜像安装
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple notebook
-i表示临时使用
cmd启动
jupyter notebook
修改工作目录
cmd:
jupyter notebook --generate-config
根据cmd中显示的路径:C:\Users\xxx.jupyter\jupyter_notebook_config.py
找到jupyter_notebook_config.py文件
- 打开文件修改配置
- 搜索notebook_dir
- 取消注释
- 把需要的目录复制粘贴到引号中,如果路径是反斜杠分割,引号前面加r
- c.NotebookApp.notebook_dir = r’(想要保存文件的目录路径)’
- 设置启动程序
- 在上一步设置的目录里面添加start.cmd
- 里面添加jupyter notebook
- 以后双击这个文件就可以打开jupyter notebook
notebook使用
- 新建文件与导入文件
- 单元格分类:code、markdown
- 命令模式(蓝色边框)与编辑模式(绿色边框)
- 常用快捷键
- 单元格类型转换:Y、M
- 插入单元格:A、B
- 进入命令模式:Esc
- 运行单元格:ctrl/shift/alt + enter
- 删除单元格:DD
- 启动代码提示功能:Tab键
ipython profile create
C:\Users\xxx\.ipython\profile_default\ipython_config.py
c.Completer.greedy = True
c.Completer.jedi_compute_type_timeout = 400
c.Completer.use_jedi = True