(默认服务器上安装好了conda环境和jupyter notebook)
1. 生成默认配置文件
jupyter notebook --generate-config
2. 进入Python终端,生成秘钥
ipython
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'argon2:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
In [3]: exit
这里要求你输入以后登录使用的密码,然后生成一个秘钥,记得保存好秘钥,以免丢失。
3. 修改配置文件
vim ~/.jupyter/jupyter_notebook_config.py
将下面的几项取消注释并修改:
c.NotebookApp.allow_remote_access = True #老版的需要此设置
c.NotebookApp.ip='*'#×允许任何ip访问
c.NotebookApp.open_browser = False
c.NotebookApp.password = 'argon2:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
c.NotebookApp.port =8888 #可自行指定一个端口, 访问时使用该端口
检测是否配置成功
在服务器开启jupyter notebook
浏览器不会自动开启
其他电脑在浏览器输入服务器ip:8888