Jupyter Notebook's terminal command not using correct conda environment

旧城冷巷雨未停 提交于 2019-12-11 06:32:41

问题


I have 2 conda environments installed:
- env1: base environment where jupyter-notebook is installed and started from
- env2: project environment with ipykernel installed I manually added kernelspecs for the 2 environments following this guide.

Everything works fine. sys.executable in 2 kernels show separate, correct paths. But for terminal commands (i.e. !which python), no matter which kernel I'm running in the environment defaults to env1.

Is there any way to have the notebook automatically change this to the kernel's environment?

P.S. I already tried installing nb_conda, nb_conda_kernels


回答1:


install nb_conda and nb_conda_kernels into your base.

conda install nb_conda nb_conda_kernels -n env1

This should give you the ability to change kernel in jupyter, and use the env2 kernel.



来源:https://stackoverflow.com/questions/53440940/jupyter-notebooks-terminal-command-not-using-correct-conda-environment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!