如何在jupyter中使用虚拟环境:
首先进入终端,输入conda env list,查看到需要用的虚拟环境(以pytorch为例)
进入该虚拟环境:conda activate pytorch
conda install ipykernel
(也可以pip install ipykernel)
python -m ipykernel install --name 这里写在jupyter中该环境的名称
(比如python -m ipykernel install --name pytorch_cpu)
这一步可能的报错:
Permission denied 'usr/local/share'
解决办法:
python -m ipykernel install --user --name pytorch_cpu
再进入终端,输入jupyter notebook,可以看到就有“pytorch_cpu”啦
image.png
https://blog.csdn.net/weixin_42382050/article/details/90214311
网友评论