参考:
1. 搭建:
- 参考:
- 安装
- 安装Anaconda,清华大学镜像-地址
2. 自定义添加快捷键
-
参考:
-
操作:
- 修改custom.js文件
# 文件位置,如果文件不存在,则创建 ~/.jupyter/custom/custom.js
- 添加代码
require(['base/js/namespace'], function(){ "use strict"; // setup shortcuts // ctrl-l: clear current cell output Jupyter.keyboard_manager.command_shortcuts .add_shortcut('ctrl-l', 'jupyter-notebook:clear-cell-output'); // ctrl-shift-l: clear all cells output Jupyter.keyboard_manager.command_shortcuts .add_shortcut('ctrl-shift-l', 'jupyter-notebook:clear-all-cells-output'); // f2: rename file Jupyter.keyboard_manager.command_shortcuts .add_shortcut('f2', 'jupyter-notebook:rename-notebook'); // ctrl-r: run all cells Jupyter.keyboard_manager.command_shortcuts .add_shortcut('ctrl-r', 'jupyter-notebook:run-all-cells'); });
- 重启Jupyter即可
- 修改custom.js文件
3. 引入自定义模块
-
参考:
-
操作:
%run 'Title.ipynb' %run 'a.py'
4. 支持使用多变量输出
- 说明:
在Jupyter里直接写变量是输出,但只支持单变量输出。使用此方法,支持多变量输出 - 操作:
- 修改:~/.ipython/profile_default/ipython_config.py文件
c = get_config() # Run all nodes interactively c.InteractiveShell.ast_node_interactivity = "all"
- 重启服务即可
- 修改:~/.ipython/profile_default/ipython_config.py文件
5. 添加密码:
- 参考:
- 说明:
- 执行命令
# 执行命令 jupyter notebook password
- 结果写入文件:~/.jupyter/jupyter_notebook_config.json
{ "NotebookApp": { "password": "sha1:91f648919f92:81b6fd6974d0718f2912db41203c26b3fa5c5591", "server_extensions": [ "jupyter_nbextensions_configurator" ] } }
- 执行命令
网友评论