我计划通过以下步骤在jupyter Notebook中使用虚拟环境:
conda create -n test python==3.6
conda activate test
ipython kernel install --user --name=test
然后我得到以下回报:
Installed kernelspec test in C:\Users\User\AppData\Roaming\jupyter\kernels\test
当我看到测试内核出现在jupyter笔记本中时,它似乎正在工作。
但是,当我切换到该内核时,它实际上是在使用默认的python环境。
我还使用以下方法检查了现有的内核:
λ jupyter kernelspec list
Available kernels:
shjh C:\Users\User\AppData\Roaming\jupyter\kernels\shjh
test C:\Users\User\AppData\Roaming\jupyter\kernels\test
python3 C:\Users\User\Anaconda3\share\jupyter\kernels\python3
它在那里但不起作用...
有关如何解决此问题的任何建议。
答案 0 :(得分:0)
不确定是什么原因导致了问题。但是幸运的是我找到了一个可行的解决方案。
首先,我使用
删除了已安装的内核jupyter kernelspec uninstall <kernel name>
然后使用ipykernel再次添加:
conda create -n test python==3.6
conda activate test
(test) λ pip install ipykernel
(test) λ python -m ipykernel install --name test --display-name "some name"