在Jupyter Notebook中选择指定的Conda虚拟环境
为你的虚拟环境安装ipykernel包,比如我之前创建了一个名为tensorflow的虚拟环境,则:
conda install -n ENV_NAME ipykernel
激活这个环境:
如果是已经安装的环境,则先激活这个环境
activate tensorflow
然后输入:
conda install ipykernel
在之后将指定环境导入jupyter的内核
python -m ipykernel install –user –name tensorflow –display-name ENV_NAME
更正,应该是这样子写
python -m ipykernel install –user –name ENV_NAME –display-name “ENV_NAME”
上面ENV_NAME是在Jupyter中显示的虚拟环境名称。
这样就可以在Jupyter Notebook中使用tensorflow这个虚拟环境了:
这个做法对分开第三方库环境的编程比较友好。
0 条评论