激活conda环境后,jupyter笔记本和ipython的路径不正确 [英] jupyter notebook and ipython don't take correct path after activating a conda environment

查看:119
本文介绍了激活conda环境后,jupyter笔记本和ipython的路径不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在/opt/anaconda3的实验室工作站中为多个用户设置了 anaconda3 ,这样其他用户就不必为自己设置全新的anaconda3安装了.

I have setup anaconda3 for multiple users in a lab workstation at /opt/anaconda3 so that other users don't have to set up a fresh anaconda3 install for themselves.

然后我创建了一个名为zud的环境供我使用.因此,目前,工作站具有以下两种环境.

Then I created an environment called zud for my use. So currently, the workstation has two environments as listed below.

(base) zuddler@silp252-dl360:~$ conda env list
# conda environments:
#
zud                      /home/zuddler/.conda/envs/zud
base                  *  /opt/anaconda3

当我使用conda activate zud激活我的环境时,jupyter和ipython没有采用正确的路径,因此我无法在我的环境中使用手动安装的库,例如,在我的环境zud中,使用conda install -c conda-forge python-igraph安装了python-igraph,但无法通过jupyter notebook或ipython访问它;他们给出ModuleNotFoundError.

When I am activating my environment using conda activate zud, jupyter and ipython are not taking the correct path and thus I am not able to use manually installed libraries in my environment, so for an example, in my environment zud I installed python-igraph using conda install -c conda-forge python-igraph but cannot access it though jupyter notebook or ipython; they give ModuleNotFoundError.

请在下面的basezud环境中浏览which命令的结果.

Please go through the results of which commands on base and zud environments below.

对于base:

(base) zuddler@silp252-dl360:~$ which python
/opt/anaconda3/bin/python
(base) zuddler@silp252-dl360:~$ which jupyter
/opt/anaconda3/bin/jupyter
(base) zuddler@silp252-dl360:~$ which ipython
/opt/anaconda3/bin/ipython
(base) zuddler@silp252-dl360:~$ which conda
/opt/anaconda3/bin/conda

zud:

(zud) zuddler@silp252-dl360:~$ which python
/home/zuddler/.conda/envs/zud/bin/python
(zud) zuddler@silp252-dl360:~$ which jupyter
/opt/anaconda3/bin/jupyter
(zud) zuddler@silp252-dl360:~$ which ipython
/opt/anaconda3/bin/ipython
(zud) zuddler@silp252-dl360:~$ which conda
/opt/anaconda3/condabin/conda

根据以上结果,我认为激活zud后,jupyter notebook和ipython的路径不正确.

from the above results, I assume that upon activating zud, jupyter notebook and ipython are not taking the correct path.

请建议此处发生的情况以及解决方法.

如果需要更多详细信息,请也告诉我,以便我可以相应地更新我的问题.

In case any further details are needed, please let me know as well so that I can update my question accordingly.

此外,如果我的问题在某个地方得到了解决,请告诉我该链接,因为我找不到解决方案.

Further, if my problem is answered somewhere, please let me know the link as I was not able to find its solution.

推荐答案

我在这里观察到了这个问题!在将conda环境从base更改为zud时,仍在base env中使用 ipython jupyter 实用程序.

I observed the issue here! On changing the conda environment from base to zud, the ipython and jupyter utilities are still being used of the base env.

背后的主要原因可能是-在zud env中,未安装ipython和jupyter.因此,都可以从base env访问它们.尝试将它们安装在zud中,看看问题是否已解决.

The main reason behind could be - In the zud env ipython and jupyter are not installed. Due to which, both are accessed from the base env. Try installing them in zud and see if the problem is fixed.

这篇关于激活conda环境后,jupyter笔记本和ipython的路径不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆