jupyter–lab 配置文件jupyter_lab_config.py

建议安装anaconda,自带python 和 jupyter lab

如果你已经在使用anaconda,并且也创建了虚拟环境,那么下面命令应当conda activate xxx 到在你的虚拟环境。



生成配置

jupyter lab --generate-config

默认的配置文件放在 "C:\Users\Administrator\.jupyter\jupyter_lab_config.py"


修改配置

c.ServerApp.allow_remote_access = True  #设置允许远程访问
c.ServerApp.local_hostnames = ['192.168.1.xxx']  #设置主机名
c.ServerApp.root_dir = 'E:\\'  #设置启动后的jupyterlab的笔记文件根目录
c.ServerApp.token = 'ddf3b439292e0f0027e36fafa3f70df04bf79c98936cb7d4' # 设置token 方便vscode配置jupyter


外部访问

外部浏览器访问 : http://192.168.1.xxx:8888/lab?token=ddf3b439292e0f0027e36fafa3f70df04bf79c98936cb7d4

vscode配置

Ctrl+shift+P 打开命令输入框

Jupyter: 创建新的空白jupyter 笔记本

Jupyter: 指定本地或着远程Jupyter服务器的连接--现有--填入 http://192.168.1.xxx:8888/lab?token=ddf3b439292e0f0027e36fafa3f70df04bf79c98936cb7d4   然后右下角会提示重启vscode,重启后,就可以创建一个笔记本用了


启动和停止jupyterlab

启动 

  • cmd窗口   jupyter lab
  • conda navagator  点击 jupyter lab 的 Lunch按钮

停止 

  • cmd窗口  jupyter-lab stop 8888

注意事项

要想让修改后的配置文件正确加载,必须正确关闭jupyter lab,

正确关闭jupyter lab的方法:  浏览器网页端---文件---shutdown

所有的配置文件键值对,必须靠左定格写

posted @ 2021-02-18 17:01  刘江龙  阅读(2774)  评论(0编辑  收藏  举报