jupyter notebook远程访问
第一步:服务器端安装jupyter notebook
conda install jupyter notebook
第二步:生成jupyter notebook默认配置文件
jupyter notebook --generate-config
第三步:生成秘钥
1.输入ipython,进入ipython命令行
2.先输入from notebook.auth import passwd
3.在输入passwd()
4.输入以后登录的秘密
5.确认登录秘密
6.将生成的秘钥保存好
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password:
Verify password:
Out[2]: 'sha1:9790b7e1fabd:5a595a2eaa78dbe11353b9a06ad7960171cc9bd1'
第四步: 修改默认配置文件
1.使用VIM打开默认配置文件
vim .jupyter/jupyter_notebook_config.py
2.取消c.NotebookApp.password的注释,修改为添加上面生成的密钥
c.NotebookApp.password = 'sha1:9790b7e1fabd:5a595a2eaa78dbe11353b9a06ad7960171cc9bd1'
3.配置允许任何IP访问
c.NotebookApp.ip = '*'
4.配置不自动打开浏览器
c.NotebookApp.open_browser = False
5.指定端口
c.NotebookApp.port = 8888
第五步:打开服务器jupyter notebook
jupyter notebook
[W 13:20:22.545 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 13:20:22.585 NotebookApp] JupyterLab extension loaded from /home/gj/anaconda3/lib/python3.8/site-packages/jupyterlab
[I 13:20:22.585 NotebookApp] JupyterLab application directory is /home/gj/anaconda3/share/jupyter/lab
[I 13:20:22.587 NotebookApp] Serving notebooks from local directory: /home/gj
[I 13:20:22.587 NotebookApp] The Jupyter Notebook is running at:
[I 13:20:22.587 NotebookApp] http://d-System-Product-Name:8888/
[I 13:20:22.587 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
第六步:在本地机器的浏览器中输入IP和端口就可以了