前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >jupyter使用简记

jupyter使用简记

原创
作者头像
qq606633
发布2023-12-04 15:31:05
2690
发布2023-12-04 15:31:05
举报

一、建议使用的版本

lab是新版,netbook是旧版,建议使用lab,他们的配置文件选项也有差别。查资料时别搞混了。

二、配置文件位置

代码语言:javascript
复制
jupyter lab --generate-config
Writing default config to: ~/.jupyter/jupyter_lab_config.py

默认的配置文件通常在用户目录的 .jupyter ,如用户 touareg, /home/touareg/.jupyter/jupyter_lab_config.py

同个jupyter安装目录,哪个用户去启动,就默认会在哪个用户的目录下找配置文件

三、密码生成

jupyter安装后初始密码是123456

把生成的串复制到配置文件上替换

代码语言:javascript
复制

from jupyter_server.auth import passwd
passwd()

四、主要的配置项

代码语言:javascript
复制
c.ServerApp.allow_remote_access = True #不开这项只能本地访问
c.ServerApp.ip = '0.0.0.0' 
c.ServerApp.open_browser = False  # 启动不自动打开浏览器
# 不写就是默认123456密码
c.ServerApp.password = 'argon2:$argon2id$v=19$m=10240,t=10,p=8$8qqFRgIA6WdCI7j7CZsJNw$4kE6w1JPcgzTJZOLwOPPk/Nruh2lsL3Q+PZr2ud83vc'
c.ServerApp.port = 3888 # 指定端口,默认8888
c.ServerApp.root_dir = '/home/touareg/jupyterworkspace' # 指定工作区根目录,启动后的左侧目录树
c.ServerApp.allow_root = True   # True 表示允许以root用户身份运行Jupyter服务器

c.ServerApp.quit_button = True # 是否在Jupyter界面显示退出按钮

c.ServerApp.terminals_enabled = True # 允许用户通过Jupyter访问系统终端

五、后台保持运行

如果没在python环境,就写jupyter安装目录的绝对路径来启动

代码语言:javascript
复制
 nohup jupyter lab > /home/touareg/jupyter.log 2>&1 &

六、conda下虚拟环境加至jupyter内核

1、 启动jupyter的环境、和新增的env都安装ipykernel 和 ipython ,且版本最好一致;

2、 创建虚拟环境后,执行 python -m ipykernel install --user --name=amcn --display-name "amcn" 添加到内核 ;

3、 刷新jupyter网页, 如需要,在jupyter网页重启一下内核;

代码语言:javascript
复制
# name是虚拟环境名
python -m ipykernel install --user --name=amcn --display-name "amcn"

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
作者已关闭评论
0 条评论
热度
最新
推荐阅读
目录
  • 一、建议使用的版本
  • 二、配置文件位置
  • 三、密码生成
  • 四、主要的配置项
  • 五、后台保持运行
  • 六、conda下虚拟环境加至jupyter内核
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档