首页 技术 正文
技术 2022年11月15日
0 收藏 351 点赞 3,124 浏览 1495 个字

1 生成配置文件

linux和mac系统打开终端

windows系统打开anaconda自带的终端

jupyter notebook --generate-config

此时系统会生成 ~/.jupyter/ 这个隐藏文件夹,且文件夹中生成了一个jupyter的配置文件jupyter_notebook_config.py

2 配置密码+端口+远程登陆+工作目录+启动mathjax

2.1 生成jupyter的密码

打开IDE或者命令行,输入如下命令

from notebook.auth import passwd
passwd()
# 此时需要输入两次密码(一次设置,一次确认),然后生成sha1的密文,拷贝下来。
# Enter password: ········
# Verify password: ········
# sha1:b11ba7ae862e:6eeb922ef6b770e43a1c90922ba341faaaaaaaa

输入passwd()后需要两次键入密码,之后会产生一段密文

2.2 修改配置文件jupyter_notebook_config.py

打开jupyter_notebook_config.py,滚动到文件最后一行,加入下面的配置选项

# 允许所有ip访问
c.NotebookApp.ip='*' # 密码 2.1中生成'sha1:xxxx"那一大串,复制时包括sha1
c.NotebookApp.password = 'sha1:0d00e0994444:3aeecafab4d91260d42647df8df4c3859a3430a9' # 是否打开浏览器
c.NotebookApp.open_browser = False # 指定端口 jupyter的默认端口为8888
c.NotebookApp.port = 10000# 启用 MathJax
c.NotebookApp.enable_mathjax = True # 修改工作空间文件夹 '/home/jupyter/'改成你的目录
c.NotebookApp.notebook_dir = '/home/jupyter/'

2.3 启动jupyter notebook

在服务器上使用jupyter notebook启动,然后本机通过http://address_of_remote:10000远程访问即可,登录界面需要输入设置的密码。

3 Jupyter安装nbextensions

如果你已经安装了,先执行卸载命令:

pip uninstall jupyter_contrib_nbextensions
pip uninstall jupyter_nbextensions_configurator

打开Anaconda Prompt窗口,执行第一个命令,用于安装nbextensions:

pip install jupyter_contrib_nbextensions

再执行第二个命令,用于安装 javascript and css files

jupyter contrib nbextension install --user

最后执行,用于安装configurator

pip install jupyter_nbextensions_configurator

然后重新启动Jupyter Notebook后,就会发现已经有Nbextensions标签了。

常用扩展功能,勾选上即可:

最常用功能说明,建议勾选上:

  • Collapsible headings 折叠标题
  • Notify 通知机制,跑一些耗时较久的任务,完成后通知
  • Codefolding 折叠代码
  • Zen mode extension 隐藏活动状态栏,方便注意代码
  • Execute time extension 显示运行的时间
相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,022
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,513
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,359
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,142
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,773
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,851