jupyter notebook远程访问

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和端口就可以了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值