日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

jupyter-lab設置自啟動及遠程連接開發環境_python

作者:絕世這天下 ? 更新時間: 2023-04-14 編程語言

1 創建JupyterLab運行腳本

首先找到jupyter-lab命令的位置,一般在~/.local/bin/下,可以創建shell腳本autoJupyterLab.sh:

#!/bin/sh
/home/myjetson/.local/bin/jupyter-lab

測試一下腳本的正確性::

./autoJupyterLab.sh

遠程連接JupyterLab成功,說明運行腳本沒問題。

2 添加JupyterLab Service文件

Ubuntu18通過systemd管理服務,因此添加服務來開機運行JupyterLab腳本。

服務Service保存在/lib/systemd/system和/etc/systemd/system下。在/etc/systemd/system下創建auto-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

3 設置Jupyter Service自啟動

讓systemd重新加載service文件:

sudo systemctl daemon-reload

然后設置auto-jupyter.service開機自啟:

sudo systemctl enable auto-jupyter.service

這樣配置就完成了。

4 測試自啟動服務

試著手動運行auto-jupyter.service,看看服務寫的有沒有問題:

sudo systemctl start auto-jupyter.service
sudo systemctl status auto-jupyter.service

重啟服務器,遠程連接jupyterlab,大功告成!

原文鏈接:https://blog.csdn.net/weixin_52201738/article/details/128901779

欄目分類
最近更新