1. 安装Jupyter
pip install jupyter
2. Jupyter的初次使用
# 进入虚拟环境 workon ai # 输入命令 jupyter notebook
本地notebook的默认URL为: http://localhost:8888
想让notebook打开指定目录,只要进入此目录后执行命令即可
3. Jupyter的常用命令及操作简介:
- 两种模式通用快捷键
Shift+Enter
,执行本单元代码,并跳转到下一单元Ctrl+Enter
,执行本单元代码,留在本单元
-
命令模式:按ESC进入
-
Y
,cell切换到Code模式 -
M
,cell切换到Markdown模式 -
A
,在当前cell的上面添加cell -
B
,在当前cell的下面添加cell
-
-
其他(了解)
-
双击D
:删除当前cell -
Z
,回退 -
L
,为当前cell加上行号 <!-- -
Ctrl+Shift+P
,对话框输入命令直接运行 -
快速跳转到首个cell,
Crtl+Home
-
快速跳转到最后一个cell,
Crtl+End
-->
-
-
编辑模式:按Enter进入
-
补全代码:变量、方法后跟
Tab键
-
为一行或多行代码添加/取消注释:
Ctrl+/
(Mac:CMD+/)
-
-
其他(了解):
Ctrl键点击鼠标 Ctrl+Z Ctrl+Y
4. MarkDown展示

5. 安装Jupyter的扩展功能
-
安装Jupyter的扩展包
pip install jupyter_contrib_nbextensions
-
使用扩展包
jupyter contrib nbextension install --user --skip-running-check
-
重新运行Jupyter,然后选择需要使用的扩展功能即可

推荐使用以下扩展:
PEP8规范

行号

拼写检查

目录

字体

代码补全

6. 当你勾选了PEP8以后会出现PEP8不能使用的情况,解决方式如下:
重新安装pep8规范模块
pip install autopep8
来源:https://www.cnblogs.com/7758520lzy/p/12586977.html