jupyter 安装部署

简介

Jupyter Notebook 的本质是一个 Web 应用程序,便于创建和共享文学化程序文档,支持实时代码,数学方程,可视化和 markdown。
用途包括:数据清理和转换,数值模拟,统计建模,机器学习等等

下载安装 jupyter

  1. 下载

    1
    2
    pip3 install jupyter
    pip3 install jupyterlab
  2. 配置

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    # ipython 生成密码
    In [1]: from notebook.auth import passwd

    In [2]: passwd()
    Enter password:
    Verify password:
    Out[2]: 'sha1:85b25f0bd15b:63e646d4f4f9be9f05e4eb97fd0df00b1e86db8e'

    # 生成默认的配置文件
    jupyter lab --generate-config

    # 配置启动参数(其他参数可以根据自己喜好设置)
    vi /home/gt/.jupyter/jupyter_notebook_config.py
    c.NotebookApp.password = 'sha1:6d74e2768be3:d4fd1139cb0d3cb01cbc03d69031a93851c83497'
    c.NotebookApp.port = 11235
    c.NotebookApp.ip = '*'
    c.NotebookApp.allow_remote_access = True
    c.NotebookApp.notebook_dir = '/home/gt/.workspace'

supervisor部署

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 安装supervisor (这里是ubuntu, 也可以支持pip)
sudo apt install supervisor

# 配置启动参数
vi /etc/supervisor/conf.d/jupyter.conf

[program:jupyter]
user=gt
directory=/home/gt/.local
command=/home/gt/.local/bin/jupyter lab
autostart=true
autorestart=false
stderr_logfile=/tmp/jupyter_stderr.log
stdout_logfile=/tmp/jupyter_stdout.log

# 启动配置的服务

其他参考资料

详细的插件介绍