安装

pip install jupyterlab

安装完毕后可启动Jupyter lab --ip=0.0.0.0
运行没问题就先关闭。

安装中文包

pip install jupyterlab-language-pack-zh-CN

配置文件

jupyter lab --generate-config

生成配置文件,在linux中,配置文件保存在~/.jupyter/jupyter_lab_config.py
可以直接加入:

c.ServerApp.allow_remote_access = True
c.ExtensionApp.open_browser = False
c.ServerApp.ip = '0.0.0.0'
c.ServerApp.password_required = False
c.ServerApp.port = 8888
c.ServerApp.token = ''
c.ServerApp.root_dir = '绝对路径,表示启动的根目录'

这里没有设置密码。
之后重启jupyterlab即可

设置开机自启

/etc/systemd/system下创建jupyter.service

[Unit]
Description=Auto Load JupyterLab
After=network.target

[Service]
Type=simple
User=your_username
ExecStart=/your_script_dir/autoJupyterLab.sh
Restart=on-failure
RestartSec=15s

[Install]
WantedBy=multi-user.target

保存文件之后重新加载配置文件:

sudo systemctl daemon-reload

然后添加开机自启:

sudo systemctl enable jupyter.service

到这里就完成了。

测试服务运行

sudo systemctl start jupyter.service
sudo systemctl status jupyter.service

没有报错就可以尝试访问了.

插件

lsp插件,实现代码补全提示
使用pip安装:

pip install jupyter-lsp
pip install python-lsp-server[all]

完事之后开启jupyter-lab,在设置里面找到代码提示,开启自动补全。

文章目录