Jupyter远程访问

Jupyter远程访问教程较多,千篇一律。

jupyter notebook --generate-config #返回配置文件路径
jupyter lab --generate-config #返回配置文件路径

In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:xxxxxxxxxxxxxxxxx'

#在配置文件jupyter_notebook_config.py或jupyter_lab_config.py末尾,加上配置
c.NotebookApp.ip='*'
c.NotebookApp.password = 'sha1:xxxxxxxxxxxxxxxxx'
c.NotebookApp.open_browser = False
c.NotebookApp.port =8888 #可自行指定一个端口, 访问时使用该端口
c.NotebookApp.open_browser = False
c.IPKernelApp.pyplot = 'inline'
c.NotebookApp.allow_remote_access = True
c.NotebookApp.notebook_dir ='/home/Notebook/'

# jupyter notebook #启动jupyter
jupyter lab
# jupyter notebook --config ./jupyter/jupyter_notebook_config_backup.py #配置自己的config文件
nohup jupyter lab --allow-root&  #root用户命令行下,启动lab

#设置开机启动,保存在/usr/lib/systemd/system/jupyter.service
[Unit]
Description=Jupyter Management
After=network.target

[Service]
User=root
Group=root
ExecStart= /root/anaconda3/bin/jupyter-lab --allow-root

Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

#重载systemctl
systemctl daemon-reload

#设置开机启动
systemctl enable jupyter

#启动jupyter
systemctl start jupyter

参考链接:
https://www.jianshu.com/p/8fc3cd032d3c
https://blog.csdn.net/qq_34419607/article/details/109177125
https://blog.csdn.net/qq_15983061/article/details/109912193

本文链接:

https://ma.ge/archives/274.html
1 + 2 =
快来做第一个评论的人吧~