安装JupyterLab
conda install -c conda-forge jupyterlab
生成配置文件
执行 jupyter lab --generate-config
生成home/username/.jupyter/jupyter_lab_config.py文件
生成密码
执行 jupyter lab password (然后输入两次设定的密码即可)
加密后存储在生成的home/username/.jupyter/jupyter_server_config.json里。
修改配置文件
sudo nano home/username/.jupyter/jupyter_lab_config.py
#允许远程访问
c.ServerApp.allow_remote_access = True
#允许 root 用户
c.ServerApp.allow_root = True
#启动时不打开浏览器
c.LabServerApp.open_browser = False
#设置公网访问
c.ServerApp.ip = ‘0.0.0.0’
安装中文语言包
pip3 install jupyterlab-language-pack-zh-CN
然后在 settings → language 中切换
debugger 语法检测
jupyter-lab 3.0 默认带有 debugger,所以不需要额外安装,但缺少依赖包,需要安装:
conda install -c conda-forge xeus-python
代码提示
conda install -c conda-forge jupyterlab-lsp
conda install -c conda-forge python-lsp-server
启动Jupyter lab
输入 jupyter lab
需要注意的地方
# ip(远程访问需要改为0.0.0.0)
c.ServerApp.ip='localhost'
# 密码(从那个json文件里复制过来,否则密码提示错误)
c.ServerApp.password = ''
# 自动打开浏览器
c.ServerApp.open_browser = False
# 指定一个端口
c.ServerApp.port = 8888
# 更改默认启动目录
c.ServerApp.notebook_dir = '/home/yyx/code'
#内联
c.IPKernelApp.pylab = 'inline'
以上