1安装jupyter
pip install jupyter
2生成配置文件
jupyter notebook --generate-config
3生成密码
from notebook.auth import passwd
passwd()
保存得到的秘钥
4编辑配置文件
vim ~/.jupyter/jupyter_notebook_config.py
修改一下5个部分(注意删除多余空格)
c.NotebookApp.ip = ‘0.0.0.0’ # 允许任意IP访问jupyter
c.NotebookApp.notebook_dir = ‘/home/’ # 设置jupyter的工作目录
c.NotebookApp.open_browser = False # jupyter启动时,禁止自动弹出浏览器
c.NotebookApp.port = 8890 # 配置jupyter的端口号
修改秘钥
启动并检查端口是否打开
jupyter notebook
输入服务器ip+端口
可能没有反应,大概率是8890这个端口没有打开
sudo firewall-cmd --query-port=8890/tcp
sudo firewall-cmd --add-port=8890/tcp --permanent
firewall-cmd --reload
final 成功
再次在本地的电脑输入ip+端口