终端为何对“ conda info”给出不同的结果?

时间:2019-06-01 17:12:28

标签: python-3.x python-2.7 anaconda conda

我在Mac上安装了Anaconda3(Python 3),已经安装了Anaconda(Python 2),现在我不知道发生了什么。

如果我打开Terminal并输入conda info,则会得到以下信息:

     active environment : None
            shell level : 0
       user config file : /Users/benjamin/.condarc
 populated config files : /Users/benjamin/.condarc
          conda version : 4.6.11
    conda-build version : 3.17.8
         python version : 3.7.3.final.0
       base environment : /Users/benjamin/anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/osx-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/benjamin/anaconda3/pkgs
                          /Users/benjamin/.conda/pkgs
       envs directories : /Users/benjamin/anaconda3/envs
                          /Users/benjamin/.conda/envs
               platform : osx-64
             user-agent : conda/4.6.11 requests/2.21.0 CPython/3.7.3 Darwin/18.6.0 OSX/10.14.5
                UID:GID : 501:20
             netrc file : None
           offline mode : False

python version:3.7.3; base environment:anaconda3;而conda info -e则显示anaconda3的base*

# conda environments:
#
                         /Users/benjamin/anaconda2
base                  *  /Users/benjamin/anaconda3

如果我进入through Anaconda终端并选择base (root)并执行相同操作,则会得到:

     active environment : /Users/benjamin/anaconda3
    active env location : /Users/benjamin/anaconda3
            shell level : 1
       user config file : /Users/benjamin/.condarc
 populated config files : /Users/benjamin/.condarc
          conda version : 4.6.14
    conda-build version : 3.0.27
         python version : 2.7.3.final.0
       base environment : /Users/benjamin/anaconda2  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/osx-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/benjamin/anaconda2/pkgs
                          /Users/benjamin/.conda/pkgs
       envs directories : /Users/benjamin/anaconda2/envs
                          /Users/benjamin/.conda/envs
               platform : osx-64
             user-agent : conda/4.6.14 requests/2.18.4 CPython/2.7.3 Darwin/18.6.0 OSX/10.14.5
                UID:GID : 501:20
             netrc file : None
           offline mode : False

# conda environments:
#
base                     /Users/benjamin/anaconda2

python version:2.7.3; base environment:anaconda2;并且conda info -e仅显示 anaconda2 base 没有 *。我希望它在python3.7.3中同时显示activebase environment的anaconda3,并进一步为anaconda3显示base*的anaconda3。为什么有什么不同?为什么我不能同时看到上述两个conda环境?

类似地,当我open Terminal购买anaconda2并做同样的事情时,我会得到:

     active environment : base
    active env location : /Users/benjamin/anaconda2
            shell level : 1
       user config file : /Users/benjamin/.condarc
 populated config files : /Users/benjamin/.condarc
          conda version : 4.6.14
    conda-build version : 3.0.27
         python version : 2.7.3.final.0
       base environment : /Users/benjamin/anaconda2  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/osx-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/osx-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/osx-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /Users/benjamin/anaconda2/pkgs
                          /Users/benjamin/.conda/pkgs
       envs directories : /Users/benjamin/anaconda2/envs
                          /Users/benjamin/.conda/envs
               platform : osx-64
             user-agent : conda/4.6.14 requests/2.18.4 CPython/2.7.3 Darwin/18.6.0 OSX/10.14.5
                UID:GID : 501:20
             netrc file : None
           offline mode : False

# conda environments:
#
base                  *  /Users/benjamin/anaconda2

这很有意义,但是active environment只是说base而不是anaconda2。当我键入conda info -e时,anaconda3没有显示。

这是我的bash_profile。

# added by Anaconda2 5.0.1 installer
export PATH="/Users/benjamin/anaconda2/bin:$PATH"

# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH

# Write alias for python3
alias python='/Library/Frameworks/Python.framework/Versions/3.6/bin/python3'

# added by Anaconda3 2019.03 installer
# >>> conda init >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$(CONDA_REPORT_ERRORS=false '/Users/benjamin/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
if [ $? -eq 0 ]; then
    \eval "$__conda_setup"
else
    if [ -f "/Users/benjamin/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/benjamin/anaconda3/etc/profile.d/conda.sh"
        CONDA_CHANGEPS1=false conda activate base
    else
        \export PATH="/Users/benjamin/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda init <<<

发生了什么事?当我进入Anaconda并选择base (root)时,我希望activebase environment成为anaconda3,而anaconda3旁边有一个*,就像现在对anaconda2一样。

0 个答案:

没有答案