服务器上可本地访问的 JupyterLab

Last

安装

1
pip3 install jupyterlab
  • 或者:
1
micromamba install jupyterlab -c conda-forge

启动

1
jupyter-lab --no-browser --port 8889

本地远程访问配置

获取密钥

  • 打开与 JupyterLab 同处一个虚拟环境的 python 交互式界面,执行以下命令:
1
2
from jupyter_server.auth import passwd
passwd()
  • 依照提示输入两遍密码,将会得到一串密钥:sha1:...

生成配置文件

1
jupyter-lab --generate-config

修改配置文件

  • 修改 ~/.jupyter/jupyter_lab_config.py 中的以下内容:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
c.ServerApp.allow_remote_access = True
c.ServerApp.ip = '*'

# open without browser
c.ServerApp.open_browser = False
c.LabServerApp.open_browser = False
c.ExtensionApp.open_browser = False
c.LabApp.open_browser = False

# the token just generated
c.ServerApp.password = 'sha1:...'

# port number
c.ServerApp.port = 8889
  • Title: 服务器上可本地访问的 JupyterLab
  • Author: Last
  • Created at : 2023-11-05 20:54:33
  • Link: https://blog.imlast.top/2023/11/05/JupyterLab-on-Server/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments
On this page
服务器上可本地访问的 JupyterLab