Jupyter Notebook远程访问配置的实现

1、生成配置文件

  • 生成配置文件命令
jupyter notebook --generate-config
PS C:\Windows\system32> jupyter notebook --generate-config
Writing default config to: C:\Users\admin\.jupyter\jupyter_notebook_config.py

2、生成一个sha1的密钥

  • 在Python中运行如下程序
from notebook.auth import passwd
passwd()
# 此时需要输入两次密码(一次设置,一次确认),然后生成sha1的密文,拷贝下来。
# Enter password: ········
# Verify password: ········
# sha1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

 

3、修改jupyter远程访问的配置

#任意ip访问
c.NotebookApp.ip = '*'
#密码为admin的sha1:dd9287a1a0ab:071ba1257bfcbb7c4ec63e6872a98081c6d2c201
c.NotebookApp.password = u'sha1:dd9287a1a0ab:071ba1257bfcbb7c4ec63e6872a98081c6d2c201'
#启动时是否自动打开浏览器
c.NotebookApp.open_browser = False
#端口号
c.NotebookApp.port = 8888

4、重新启动jupyter

jupyter notebook
PS C:\Windows\system32> jupyter notebook
[W 08:56:21.192 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 08:56:21.211 NotebookApp] Serving notebooks from local directory: D:\Jupyter
[I 08:56:21.212 NotebookApp] The Jupyter Notebook is running at:
[I 08:56:21.213 NotebookApp] http://(DESKTOP-T88P8CG or 127.0.0.1):8888/
[I 08:56:21.214 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

5、输入网址登录

6、远程登录

  • 获取本机ip地址
  • PS C:\Windows\system32> ipconfig
    
    Windows IP 配置
    
    
    以太网适配器 以太网:
    
       连接特定的 DNS 后缀 . . . . . . . :
       本地链接 IPv6 地址. . . . . . . . : fe80::89ab:89bf:48f2:7e06%6
       IPv4 地址 . . . . . . . . . . . . : 192.168.1.178
       子网掩码  . . . . . . . . . . . . : 255.255.255.0
       默认网关. . . . . . . . . . . . . : 192.168.1.1
  • 输入ip地址与jupyter设置的端口8888
  • http://192.168.1.178:8888/
  • 局域网内任何计算机可直接浏览器输入http://192.168.1.178:8888/进行访问,如果电脑为公网ip则任何计算机均可访问否则需借助内网穿透工具进行地址与端口转发。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值