[英]how do you check to see if any conda environment is active with a flag
How can I tell if any conda environment is active with a flag?如何判断是否有任何带有标志的 conda 环境处于活动状态?
ie when I try to run即当我尝试跑步时
conda deactivate && conda env list
or when I run或者当我跑步时
conda activate && conda env list
they both output the same thing他们都是 output 一样的东西
# conda environments:
#
base * /Users/name/opt/miniconda3
I found the answer myself.我自己找到了答案。 There is a CONDA_SHLVL
environment variable.有一个CONDA_SHLVL
环境变量。
[[ $CONDA_SHLVL == 1 ]] && echo "conda environment is active"
Another option would be to run另一种选择是运行
conda info
but the output must be parsed conda info
但必须解析 output
when a conda env is not active it will display当 conda env 未激活时,它将显示
william‣ wmbp‣ ~ % conda info
active environment : None
...
You can also use conda env list
which will show all available environments with an asterisk next to the currently active one.您还可以使用conda env list
,它将显示所有可用环境,并在当前活动的环境旁边显示一个星号。
$ conda env list
# conda environments:
#
base /Users/yourname/miniconda3
dataEnv * /Users/yourname/miniconda3/envs/dataEnv
webParsing /Users/yourname/miniconda3/envs/webParsing
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.