今天用jupyternotebook来学习github上的一个项目,发现运行时报ModuleNotFoundError的错。检查了一下发现问题应该处在notebook的kernel上。因为我在电脑上装了不同的python环境,所以想要用特定的包就需要切换python环境。这里通过kernel实现。
增加kernel
第一步:打开cmd,进入想要使用的python环境下。在该环境下利用pip安装ipykernel。
(python36) C:\Users\mark吐温>pip install ipykernel
第二步:安装完成后,输入jupyter kernelspec list命令查看当前的kernel。
(python36) C:\Users\mark吐温>jupyter kernelspec list
Available kernels:
python3 d:\anaconda3\envs\python36\share\jupyter\kernels\python3
第三步:同样在该python环境下,输入以下命令创建新的kernel。(注意:‘–name python36’中的python36是你可以指定的kernel名字。)
(python36) C:\Users\mark吐温>python -m ipykernel install --name python36
第四步:查看当前kernel。可以看到已经增加了名为python36的kernel。
(python36) C:\Users\mark吐温>jupyter kernelspec list
Available kernels:
python3 d:\anaconda3\envs\python36\share\jup

最低0.47元/天 解锁文章
5万+

被折叠的 条评论
为什么被折叠?



