window上jupyter中配置kernel
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
其他虚拟环境中,同理直接进行内核配置即可。