本文主要是介绍在WSL子系统安装Jupyter Lab且进行穿透外网访问,显示不同的conda虚拟环境,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
pip下载jupyterlab
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple jupyterlab
生成配置文件
(base) shengwei@sys4090:~$ jupyter lab --generate-config
Writing default config to: /home/shengwei/.jupyter/jupyter_lab_config.py
打开配置文件进行修改
vim /home/shengwei/.jupyter/jupyter_lab_config.py
c.ServerApp.allow_remote_access = True # 是否允许远程访问
c.ServerApp.ip = '*'
c.ServerApp.port = 8888 # 默认端口8000
c.ServerApp.open_browser = False
c.ServerApp.root_dir = '/data' # 可自己设
设置中文
pip install jupyterlab-language-pack-zh-CN
不同python虚拟环境kernel的切换
pip install ipykernel
设置jupyter开机自启
sudo vim /etc/systemd/system/jupyter.service
[Unit]
Description=Jupyterlab
After=network.target
[Service]
Type=simple
ExecStart=/home/shengwei/anaconda3/bin/jupyter-lab --config=/home/shengwei/.jupyter/jupyter_lab_config.py --no-browser
User=ubuntu
Group=ubuntu
WorkingDirectory=/home/shengwei/workspace
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
---
sudo systemctl enable jupyter
sudo systemctl start jupyter (启动)
sudo systemctl stop jupyter (停止)
sudo systemctl restart jupyter (重启)
方式二
vim jupyter-start.sh
#!/bin/sh/bin/echo $(/bin/date +%F_%T) >> /home/ubuntu/startup.log
nohup /home/ubuntu/miniconda3/bin/jupyter-lab --allow-root > jupyter.log 2>&1 &ps -le | grep jupyterexit 0
bash jupyter-start.shst
做外网访问
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=8888 connectaddress=172.18.237.249 connectport=8888
这篇关于在WSL子系统安装Jupyter Lab且进行穿透外网访问,显示不同的conda虚拟环境的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!