无法激活特定的 anaconda 环境

无法激活特定的 anaconda 环境

我正在尝试激活一个 Python 环境,但当我检查哪个 Python 时,它没有反映出变化。而且这种情况只发生在一个特定的环境中。示例如下。

(datasc) vincent (master) scripts $ conda info --env
# conda environments:
#
base                     /home/vincent/anaconda3
code-buf                 /home/vincent/anaconda3/envs/code-buf
datasc                *  /home/vincent/anaconda3/envs/datasc
dato-env                 /home/vincent/anaconda3/envs/dato-env
django                   /home/vincent/anaconda3/envs/django
gql_extraction_py        /home/vincent/anaconda3/envs/gql_extraction_py
new_gql                  /home/vincent/anaconda3/envs/new_gql
py2datasc                /home/vincent/anaconda3/envs/py2datasc
python_2_expt            /home/vincent/anaconda3/envs/python_2_expt
web-dev                  /home/vincent/anaconda3/envs/web-dev

(datasc) vincent (master) scripts $ which python
/home/vincent/anaconda3/bin/python

(datasc) vincent (master) scripts $ conda activate
(base) vincent (master) scripts $ which python
/home/vincent/anaconda3/bin/python

(base) vincent (master) scripts $ conda activate code-buf
(code-buf) vincent (master) scripts $ which python
/home/vincent/anaconda3/envs/code-buf/bin/python

(code-buf) vincent (master) scripts $ conda activate datasc
(datasc) vincent (master) scripts $ which python
/home/vincent/anaconda3/bin/python

因此,导入失败,因为它寻找的包在基础环境中不存在。有什么建议吗?

答案1

嗯。目前还没有回复。目前的解决方法似乎是:

conda deactivate
conda activate datasc

which python 现在返回 envs python。所以我想现在这样就行了。

相关内容