1.新建虚拟环境,名称为 pytorchEnv
2.激活环境,并安装ipykernel库
命令输入:pip install ipykernel
图所示:
结果:
3.pip install ipykernel期间报错:(强烈建议使用pip安装)
错误如图:
解决办法:【Python】报错:No matching distribution found for ipykernel (from XXX) —— win 10:pip 安装第三方库时报错解决
4.1conda install ipykernel 期间报错:
未报错可忽略
错误:
CondaError: Cannot link a source that does not exist.
解决办法:
a.命令行输入:
conda config --add channels
‘https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/’ conda
config --set show_channel_urls yes
b.在c:/用户/.condarc中添加
channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- defaults
show_channel_urls: yes
如下图:
4.2.命令行输入如下:
5.在相应的虚拟环境中,执行:
python -m ipykernel install --user --name 虚拟环境名 --display-name 在jupyter中要显示的名
如图:
6.删除jupyter的解释器:
jupyter kernelspec remove 名称