安装Jupyter

notebook环境

1
pip install jupyter notebook

配置

jupyter notebook 配置

1
2
3
jupyter notebook --generate-config

# Writing default config to: /home/ubuntu/.jupyter/jupyter_notebook_config.py

创建密码(自动配置)

终端输入jupyter notebook password,

Enter password: xxxx
Verify password: xxxx

成功后显示 Wrote hashed password to /home/ubuntu/.jupyter/jupyter_server_config.json

修改jupyter notebook的配置文件

vim ~/.jupyter/jupyter_notebook_config.py

在该文件中做如下修改或直接在文件尾端添加:

1
2
3
4
c.NotebookApp.allow_remote_access = True #允许远程连接
c.NotebookApp.ip='*' # 设置所有ip皆可访问
c.NotebookApp.open_browser = False # 禁止自动打开浏览器
c.NotebookApp.port =8888 #任意指定一个端口

启动

启动Jupyter

终端输入

1
jupyter notebook

使用nohup后台运行

1
nohup jupyter notebook >~/jupyter.log 2>&1 &

远程访问

浏览器输入

1
服务器ip:端口号

image-20230812195930653

输入密码即可访问