远程运行jupyter notebook:密码登录和token登录

您所在的位置:网站首页 远程手机设置密码 远程运行jupyter notebook:密码登录和token登录

远程运行jupyter notebook:密码登录和token登录

2024-07-12 17:55| 来源: 网络整理| 查看: 265

jupyter notebook的升级版jupyter_lab lab的远程连接:https://alanlee.fun/2018/07/14/remote-jupyter/

安装 pip install ipython

远程只要装好ipython就好了 如果已经安装好,首先关掉本地ipython,本地安装以下

pip install jupyter_contrib_nbextensions jupyter contrib nbextension install --user --skip-running-check

安装好后再启动ipython,会发现它多了一个 Nbextensions 在这里插入图片描述 点击之后可以看到有很多插件,选择“目录” 在这里插入图片描述 这样就添加好了。 打开一个ipython文件,就可以看到多了下图的图标 在这里插入图片描述

启动一:token登录

远程登录进服务器 user@ip adress:用户名@远程地址 远程输入命令

jupyter notebook --no-browser --port=8898 --ip=127.0.0.1

注意:这个port=后面的数字可以自行改变,换成任意的没有被占用的端口即可

会出现下面的内容

Copy/paste this URL into your browser when you connect for the first time, to login with a token: http://127.0.0.1:8898/?token= 启动二:密码登录(强推) 1、配置远程服务器 1.1 为访问设置密码 ipython [1]from notebook.auth import passwd [2]passwd() Enter password: Verify password: #记住自己设置的密码 Out[2]: 'sha1:ce23d945972f:3476XXXX4a18c63968a41f1140274' #复制下来,等会用得到 1.2 生成配置文件

$jupyter notebook --generate-config

1.3 修改配置文件

$vim ~/.jupyter/jupyter_notebook_config.py 修改为如下结果

c.NotebookApp.ip='*' c.NotebookApp.password = u'sha:ce...刚才复制的那个密文' c.NotebookApp.open_browser = False c.NotebookApp.port =8888 2、本地ssh远程服务器

ssh默认端口为22,正常就ssh username@remote_ip -L 127.0.0.1:[port]:127.0.0.1:8888即可 (特殊情况下ssh -p 2222 username@remote_ip....) 登录进服务器后,cmd输入nohup jupyter notebook --ip=0.0.0.0 > tool.log 2>&1 &,其中--ip=0.0.0.0是为了让任意ip地址可以访问jupyter,jupyter转入后台运行

3、本地浏览器打开

地址栏输入:http://localhost:[port]/tree/ 输入密码即可访问



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3