欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 文化 > Jupyter远程服务器设置

Jupyter远程服务器设置

2024/10/24 3:25:58 来源:https://blog.csdn.net/m0_37749564/article/details/140265358  浏览:    关键词:Jupyter远程服务器设置

文章目录

  • Jupyter远程服务器设置
    • 安装 Jupyter
    • 设置密码
    • 生成配置文件
    • 修改配置文件
    • 启动Jupyter
  • 参考文档

Jupyter远程服务器设置

此文来自 Jupyter 开启远程服务器

最近在做 AI 方面的研究,用到了 python。使用python编辑器或者vim 在遇到输入错误需要重新输入的时候,会感觉很别扭,尤其是在 for 循环等中。而 jupyter 可以实现文本编辑并运行的效果,对我而言提高了效率。

安装 Jupyter

pip install notebook jupyterlab

设置密码

自动设置

$  jupyter server password
Enter password:  ****
Verify password: ****
[JupyterPasswordApp] Wrote hashed password to /Users/you/.jupyter/jupyter_server_config.json

手动设置
打开python,输入以下语句:

from jupyter_server.auth import passwd
passwd()
Enter password:
Verify password:
'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'

生成配置文件

$  jupyter server --generate-config
Writing default config to: /root/.jupyter/jupyter_server_config.py

修改配置文件

打开 jupyter_notebook_config.py, 修改里面的:

c.ServerApp.allow_remote_access = True
c.ServerApp.allow_root = True
# 开启远程访问ip
c.ServerApp.ip = '*'
c.ServerApp.open_browser = False
c.ServerApp.password_required = True
# 使用自动设置密码,则此处不需要配置手动密码
c.ServerApp.password = ''
设置端口号
c.ServerApp.port = 9999
# notebook存储目录
c.ServerApp.notebook_dir = '/root/app/jupyter'

启动Jupyter

在命令行输入 jupyter notebook就可以开启服务了。但我们一般希望Jupyter Notebook在后台运行,所以可以输入以下命令

$ nohup jupyter notebook --allow-root >/dev/null 2>&1 &
启动juypterlab:
$ nohup jupyter lab --allow-root >/dev/null 2>&1 &

因为 jupyterlab中包含jupyter notebook, 所以启动jupyterlab,则同时也启动了jupyter notebook.

参考文档

Jupyter 开启远程服务器(最新版)

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com