当前位置: 首页 > news >正文

Anaconda下安装配置Jupyter

Anaconda下安装配置Jupyter

1、安装

conda activate my_env	#激活虚拟环境
pip install jupyter	#安装
jupyter notebook --generate-config	#生成配置文件

提示配置文件的位置:


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

检查版本:

# jupyter --version
Selected Jupyter core packages...
IPython          : 8.12.3
ipykernel        : 6.29.5
ipywidgets       : 8.1.3
jupyter_client   : 8.6.2
jupyter_core     : 5.7.2
jupyter_server   : 2.14.2
jupyterlab       : 4.2.4
nbclient         : 0.10.0
nbconvert        : 7.16.4
nbformat         : 5.10.4
notebook         : 7.2.1
qtconsole        : 5.5.2
traitlets        : 5.14.3

2、配置

(1)修改配置参数

打开jupyter 的配置文件 ,修改以下配置内容:

c.ServerApp.notebook_dir = ‘/root/jupytercode’# 配置程序代码路径
c.ServerApp.port = 8686	#配置可用端口
c.ServerApp.open_browser = False	#禁止自动打开浏览器
c.ServerApp.allow_remote_access = True	#允许远程访问
c.ServerApp.allow_root = True #允许root用户
c.ServerApp.ip = '*' # 允许所有IP访问

注意:配置参数前面一定不能有空格

开始没有注意,服务总是不能启动,看日志中:

File "/root/anaconda3/envs/nlp/lib/python3.8/site-packages/traitlets/config/loader.py", line 655, in _read_file_as_dictexec(compile(f.read(), conf_filename, "exec"), namespace, namespace)  # noqa: S102File "/root/.jupyter/jupyter_notebook_config.py", line 653c.ServerApp.allow_remote_access = True^IndentationError: unexpected indent
(2)防火墙端口

把防火墙上的8686端口打开

firewall-cmd --list-port
firewall-cmd --zone=public --add-port=8686/tcp --permanent
firewall-cmd --reload
(3)本机测试

用 wget 测试网址

# wget 192.168.88.128:8686
--2024-07-23 00:48:24--  http://192.168.88.128:8686/
正在连接 192.168.88.128:8686... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:/tree? [跟随至新的 URL]
--2024-07-23 00:48:24--  http://192.168.88.128:8686/tree?
再次使用存在的到 192.168.88.128:8686 的连接。
已发出 HTTP 请求,正在等待回应... 302 Found
位置:/login?next=%2Ftree%3F [跟随至新的 URL]
--2024-07-23 00:48:24--  http://192.168.88.128:8686/login?next=%2Ftree%3F
再次使用存在的到 192.168.88.128:8686 的连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:6254 (6.1K) [text/html]
正在保存至: “index.html”100%[===========================================================================================================>] 6,254       --.-K/s 用时 0s2024-07-23 00:48:24 (194 MB/s) - 已保存 “index.html” [6254/6254])

说明可以访问。

(4)设置密码

在浏览器中访问:
在这里插入图片描述
按提示执行命令 jupyter server list:

# jupyter server list
Currently running servers:
http://localhost:8686/?token=53c428fd7e7cfb9b440e29bf73c8ec12a9602d53243ad49e :: /root/jupytercode

把token后的密码串,复制到token的文本框中,然后输入密码。
网站设置成功!

(5)后台启动

设置到后台启动:

nohup  jupyter notebook  > /root/.jupyter/jupyter.log 2>&1 &
http://www.lryc.cn/news/404811.html

相关文章:

  • 蓝队黑名单IP解封提取脚本
  • 共享充电桩语音ic方案,展现它的“说话”的能力
  • ARM 单片机裸机任务调度框架
  • .Net 8 控制台程序部署(Linux篇)
  • LeetCode:x的平方根(C语言)
  • 深入浅出WebRTC—DelayBasedBwe
  • JAVA开发工具IDEA如何连接操作数据库
  • 简化AI模型:PyTorch量化技术在边缘计算中的应用
  • 拥抱AI时代:解锁Prompt技术的无限潜力与深远影响
  • 第123天:内网安全-域防火墙入站出站规则不出网隧道上线组策略对象同步
  • 博客建站4 - ssh远程连接服务器
  • MySQL--索引(3)
  • sql_exporter通过sql收集业务数据并通过prometheus+grafana展示
  • pytorch 笔记:torch.optim.Adam
  • 开源AI智能名片小程序:深度剖析体验优化策略,激活小程序生命力的运营之道
  • ML.Net 学习之使用经过训练的模型进行预测
  • 为什么 centos 下使用 tree 命令看不见 .env 文件
  • 数据库基础与性能概述及相关术语
  • docker基于外部缓存加速构建方案
  • 【C语言】 作业11 链表+实现函数封装
  • 【Ubuntu】Ubuntu20修改MAC地址
  • ClickHouse集成LDAP实现简单的用户认证
  • C语言-预处理详解
  • 计算机网络-VLAN间通信(三层通信)模拟实现
  • 【JAVA】数据类型及变量
  • 微软蓝屏事件暴露的网络安全问题
  • 11 - FFmpeg - 编码 AAC
  • OS Copilot初体验的感受与心得
  • Ajax学习笔记
  • 医学深度学习与机器学习融合的随想