远程调用服务器的jupyter notebook设置

远程调用服务器的jupyter notebook设置

具体实现代码如下

(base) hu@ubuntu-server:~$ jupyter notebook --generate-config
(base) hu@ubuntu-server:~$ ipython
In [1]: from notebook.auth import passwd
In [2]: passwd()
Enter password: ****
Verify password: ****
Out[2]:  'sha1:41357d7305ce:f176435275b8245bb5409fbde417cd05efcf4bc4'
# 输出的一串notebook 登录的hash值,需要记住
# Ctrl + D 退出ipython
(base) hu@ubuntu-server:~$ vim ~/.jupyter/jupyter_notebook_config.py
# 添加下面的几句到jupyter_notebook_config.py,保存退出
c.NotebookApp.allow_remote_access = True  # 允许远程访问
c.NotebookApp.ip = '*'  # 设置访问的IP地址,*为所有
c.NotebookApp.open_browser = False  # 不启动浏览器
c.NotebookApp.password = u'sha1:41357d7305ce:f176435275b8245bb5409fbde417cd05efcf4bc4'    # notebook登录密码的hash值
c.NotebookApp.port = 9000 # 设置访问端口, 默认是8888 ,冲突的话需要修改

# 在服务器上运行jupyter notebook
(base) hu@ubuntu-server:~$ jupyter notebook

# 本地重新开一个终端
(pyt38) hu@hu-hp:~$ ssh -N -f -L localhost:8000:localhost:9000 hu@172.20.167.167
# 9000是在jupyter_notebook_config.py设置的访问端口,8000是本地转换的端口,服务器地址:hu@172.20.167.167

# 之后在本地的浏览器输入:localhost:8000 即可进入登录页面,输入之前设置的密码就可进入jupyter notebook
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值