首页 > 解决方案 > 一个 conda 环境自动在 jupyter notebook 中获取其他环境的依赖项

问题描述

我有两个名为 'myenv' 和 'newenv' 的 conda 环境,我在 myenv 中安装了 tensorflow,但没有在 newenv 中安装,在这两个环境中我都使用: pip install ipykernel 然后: python -m ipykernel install --user --name name_env --display-name "Python (name_env)" 我在两个环境中都这样做了,所以现在我的 jupyter notebook 中有 3 个内核,名为: Python(myenv),Python(newenv),Python3 。但是当更改为内核 newenv 并尝试导入 tensorflow 并且它导入但是我没有在 newenv 中安装 tensorflow 但是当我尝试通过 newenv 的命令终端导入它时,它显示错误“没有名为 tensorflow 的模块”。那为什么它在 jupyter notebook 中导入而不是在命令终端中?请帮我解决这个问题。

标签: pythontensorflowjupyter-notebook

解决方案


推荐阅读