window上jupyter中配置kernel

文章介绍了在Windows系统中,如何在Jupyter中重新配置kernel,包括在conda环境下添加国内镜像源以加速包的下载,以及详细步骤创建和安装新的kernel(如pytorch_02)。主要步骤包括查看和配置conda环境,安装ipykernel,激活特定环境并指定内核名称。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

window上jupyter中配置kernel

背景

因上次重置系统,C盘数据格式化,jupyter中配置的信息都丢失了。今天打开jupyter后发现kernel没有,所以今天就重新配置一下kernel.

配置国内镜像

因为当前需要下载ipykernel安装包,也为了后续安装其他包更方便。

进入cmd命令窗口:

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes

###查看镜像配置
conda config --show-sources


==> C:\Users\Lenovo-T15\.condarc <==
channels:
  - https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
  - defaults
show_channel_urls: True

配置新的kernels

  • 0、查看当前环境 (conda的环境保存在D盘了所以没有丢失!!!
(pytorch_02) C:\Users\Lenovo-T15>conda info --envs
# conda environments:
#
base                     D:\Software\Anaconda
DeepCTR-master           D:\Software\Anaconda\envs\DeepCTR-master
SparrowRecSys-master     D:\Software\Anaconda\envs\SparrowRecSys-master
py38                     D:\Software\Anaconda\envs\py38
pytoch_01                D:\Software\Anaconda\envs\pytoch_01
pytorch                  D:\Software\Anaconda\envs\pytorch
pytorch_02            *  D:\Software\Anaconda\envs\pytorch_02
pytorch_03               D:\Software\Anaconda\envs\pytorch_03
tensorflow-gpu           D:\Software\Anaconda\envs\tensorflow-gpu
tf                       D:\Software\Anaconda\envs\tf
  • 1、首先先要安装好ipykernel
conda install notebook ipykernel

# 查看配置的内核
jupyter kernelspec list

Available kernels:
  python3    C:\Users\Lenovo-T15\AppData\Roaming\jupyter\kernels\python3
  • 2、进入虚拟环境
activate pytorch_02
  • 3、配置内核(–name参数指定内核名称
python -m ipykernel install --user --name pytorch_02
  • 4、内核配置检验
#检验查看配置的内核
jupyter kernelspec list

Available kernels:
  python3       C:\Users\Lenovo-T15\AppData\Roaming\jupyter\kernels\python3
  pytorch_02    C:\Users\Lenovo-T15\AppData\Roaming\jupyter\kernels\pytorch_02
  

其他虚拟环境中,同理直接进行内核配置即可。

在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值