欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Jupyter Notebook安装与配置

程序员文章站 2022-05-25 16:18:16
...

1. 安装ipython, jupyter
pip install ipython
pip install jupyter


2.创建配置文件
jupyter notebook --generate-config

会在当前用户进入目录生成.jupyter目录,并生成jupyter_notebook_config.py文件,如
/root/.jupyter/jupyter_notebook_config.py

3.生成密码

1)在终端输入ipython 进入ipython界面
2)输入下面两行命令
from notebook.auth import passwd
passwd()
3)根据提示输入两次密码,然后复制界面输出的字符长串

In [1]: from notebook.auth import passwd

In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'argon2:$argon2id$v=19$m=10240,t=10,p=8$1eEGdP3pQxhSiSnEOsPIOA$pseS7SD4ddZf//FR7N5eFB'

4.修改配置文件
vi /root/.jupyter/jupyter_notebook_config.py,定位到文件末尾添加下面几项配置

一般添加下面几项就行:
c.NotebookApp.password ='argon2:$argon2id$v=19$m=10240,t=10,p=8$1eEGdP3pQxhSiSnEOsPIOA$pseS7SD4ddZf//FR7N5eFB'
c.NotebookApp.ip='*'
c.NotebookApp.open_browser = False
c.NotebookApp.port =8080
allow_remote_access = True
c.NotebookApp.notebook_dir = '/data/jupyter'