JupyterLab
是 Jupyter Notebook
的下一代产品,提供更加强大的功能。
安装
JupyterLab
可以使用 conda
、mamba
、pip
、pipenv
或 docker
安装。
conda
Conda 软件包和环境管理系统
conda install -c conda-forge jupyterlab
mamba
mamba install -c conda-forge jupyterlab
pip3
pip3 install jupyterlab
Docker
docker run -it --rm -p 8888:8888 -e JUPYTER_ENABLE_LAB=yes jupyter/datascience-notebook
启动
# 生产 ssl 证书,可以省略
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /root/selfcert.key -out /root/selfcert.pem
# 生产配置文件
jupyter lab --generate-config
# 生成密码
$ pip3 install ipython
$ ipython
In [1]: from jupyter_server.auth import passwd; passwd()
Enter password:
Verify password:
Out[1]: 'argon2:$argon2id$v=19$m=10240,t=10,p=8$****'
# 修改配置文件
$ vim /root/.jupyter/jupyter_lab_config.py
c.NotebookApp.allow_origin = '*'
c.ServerApp.ip = '172.20.0.20' # 监听地址
c.ServerApp.port = 8888 # 端口
c.ServerApp.open_browser = False # 启动是否打开浏览器
c.ServerApp.password = 'argon2:$argon2id$v=19$m=10240,t=10,p=8$****' # 密码为上步Out[1]的值
c.ServerApp.notebook_dir = '/data/jupyter_dir' # jupyter 默认的根目录
c.ServerApp.certfile = '/root/selfcert.pem' # ssl 证书
c.NotebookApp.keyfile = '/root/selfcert.key'
# 启动
nohup jupyter lab --allow-root &
nohup jupyter lab &
# 访问
http://172.20.0.20:8888/lab
配置
# 为文件添加目录
jupyter labextension install jupyterlab-toc
# 配置插件
Settings -> Advanced Settings Editor -> Extension Manager -> "enabled": true
Settings -> Enable Extension Manager
类似工具
借助 Colaboratory(简称 Colab
),您可在浏览器中编写和执行 Python
代码,并且: