加入收藏 | 设为首页 | 会员中心 | 我要投稿 银川站长网 (https://www.0951zz.com/)- 云通信、基础存储、云上网络、机器学习、视觉智能!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

linux上的配置和远程访问的方式

发布时间:2023-10-09 13:08:23 所属栏目:Linux 来源:
导读:upyter Notebook已经逐渐取代IDE成为了多平台上写简单Python脚本或应用的几家选择。Jupyter Notebook可以通过pip/pip3安装:pip3 install jupyter然后在目标文件夹目录下,输入指令jupyter notebook开启服务,可在浏

upyter Notebook已经逐渐取代IDE成为了多平台上写简单Python脚本或应用的几家选择。

Jupyter Notebook可以通过pip/pip3安装:

pip3 install jupyter

然后在目标文件夹目录下,输入指令jupyter notebook开启服务,可在浏览器地址localhost:8888中访问主页

允许远程访问

在本地,我们访问localhost:8888就能看到Jupyter Notebook的本地主页,但是在远程访问中,并不能直接这么做。因此需要以下一些操作:

1. 生成一个 notebook 配置文件

默认情况下,配置文件 ~/.jupyter/jupyter_notebook_config.py 并不存在,需要自行创建。使用下列命令生成配置文件:

jupyter notebook --generate-config

如果是 root 用户执行上面的命令,会发生一个问题:

Running as root it not recommended.

Use --allow-root to bypass.

提示信息很明显,root 用户执行时需要加上 allow-root 选项。

jupyter notebook --generate-config --allow-config

执行成功后,会出现下面的信息:

Writing default config to: /root/.jupyter/jupyter_notebook_config.py

2. 生成密码

从 jupyter notebook 5.0 版本开始,提供了一个命令来设置密码:jupyter notebook password,生成的密码存储在 jupyter_notebook_config.json。

$ jupyter notebook passwordEnter password: ****Verify password: ****[NotebookPasswordApp] Wrote hashed password to /Users/you/.jupyter/jupyter_notebook_confi

3. 远程访问

以上设置完以后就可以在服务器上启动 jupyter notebook,jupyter notebook, root 用户使用 jupyter notebook --allow-root。打开 IP:指定的端口(默认为8888), 输入密码就可以访问了。

若8888端口被占用,浏览器打开 IP:指定的端口(默认为8888) 应该访问不了,可以用如下方式启动 jupyter notebook

jupyter notebook --no-browser --port 6000 --ip=192.168.1.103

就是指定端口号和ip。通过这种方式在浏览器输入 ip:端口号,应该就能看到对应界面了。

(编辑:银川站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章