---
title: "Jupyter Notebook安装与配置"
author: "daizj"
date: "2021-02-25T10:02:38Z"
tags: []
categories: ["编程语言"]
slug: "jupyter-notebook"
draft: false
lastmod: "2021-02-25T10:03:46Z"
id: 2519299
url: "https://daizj.iteye.com/blog/2519299"
---

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 : from notebook.auth import passwd

In : passwd()
Enter password: 
Verify password: 
Out: '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'