安装

  1. pip3 install jupyterlab

生成配置文件及密码

  1. jupyter lab --generate-config
  2. ipython
  3. In [1]: from notebook.auth import passwd
  4. In [2]: passwd()
  5. Out[2]: 'argon2:$argon2id$v=19$m=10240,t=10,p=8$McKErBf9enzhsvSnwLdU4g$VELawmya+VPaR9w1juYauGW2jqBUEPMES2AtqyhmDgs'
  6. # 这个密文复制下来,粘贴进配置文件

修改配置文件

  1. vi /root/.jupyter/jupyter_lab_config.py
  2. c.NotebookApp.ip = '*'
  3. c.NotebookApp.password = u'argon2:$argon2id$v=19$m=10240,t=10,p=8$McKErBf9enzhsvSnwLdU4g$VELawmya+VPaR9w1juYauGW2jqBUEPMES2AtqyhmDgs'
  4. c.NotebookApp.open_browser = False
  5. c.NotebookApp.port = 8888
  6. c.NotebookApp.notebook_dir = '/media/disk/service/jupyterlab'
  7. c.NotebookApp.allow_remote_access = True
  8. # 注意防火墙开启 8888 端口

使用screen会话永久开启jupyterlab服务

  1. # 开启一个名称为jupyterlab的会话
  2. screen -S jupyterlab
  3. # 开启jupyterlab服务
  4. jupyter lab --allow-root
  5. # 快捷键 Ctrl + A + D 退出会话窗口,服务仍然运行
  6. # 查看所有会话
  7. screen -ls

安装中文插件

  1. pip3 install jupyterlab-language-pack-zh-CN

然后刷新浏览器, setting -> language -> 中文