jupyter配置
生成配置文件
jupyter notebook --generate-config
配置文件路径
/home/issen/.jupyter/jupyter_notebook_config.py
密码生成
在ipython中
from notebook.auth import passwd
passwd()
输入密码,将得到的字符串填到c.NotebookApp.password
# 用户认证密码
c.NotebookApp.password=‘argon2:$argon2id$v=19$m=10240,t=10,p=8$gZ6hmT49H9ieR+9Rxr6IYw$QzTpGS4neDCrmc8aTGHejg‘
# 设置配置目录
c.JupyterApp.config_file = ‘~/.jupyter/jupyter_notebook_config.py‘
c.NotebookApp.allow_remote_access = True # 允许远程访问
#设置jupyter的资源主页路径,即[jupyter主页]
# c.NotebookApp.base_url = ‘/home/issen/.virtualenvs/anaconda/bin‘
# 静态文件目录/home/issen/.virtualenvs/anaconda/share/jupyter/lab/static
c.NotebookApp.enable_mathjax = True # 启用mathjax
c.NotebookApp.ip = ‘*‘ # 设置了访问该jupyter应用的来源机器只能是本机
c.NotebookApp.notebook_dir = ‘/home/issen/data/jupyter‘ #jupyter工作目录,所有在jupyter创建的文件都会保存到这里
c.NotebookApp.open_browser = False # 禁止启动时自动开启浏览器
c.NotebookApp.port = 8888 # 监听端口
systemctl服务
vim /usr/lib/systemd/system/jupyter.service
[Unit]
Description=Jupyter Management
After=network.target
[Service]
Type=simple
User=issen
Group=root
WorkDirectory=/home/issen/data/jupyter
#Environment=/home/issen/.jupyter/jupyter_notebook_config.py
# 启用环境变量,使服务能够加载配置文件
EnvironmentFile=/home/issen/.virtualenvs/anaconda/bin/jupyter-lab
ExecStart=/home/issen/.virtualenvs/anaconda/bin/jupyter-lab --allow-root
Restart=on-failure
RestartSec=10
#StandardOutput=/home/issen/data/jupyter/log/jupyter_run.log
#StandardError=/home/issen/data/jupyter/log/jupyter_error.log
[Install]
WantedBy=multi-user.target
jupyter远程访问
原文:https://www.cnblogs.com/issenxiao/p/14693093.html