I'm wondering if there is an easy way to check which conda environment is currently activated.
I know you can do conda env list
and the active environment will be printed with a *.
However, I would like to do this programmatically as an input into an else if statement.
parsing the output of conda env list is rather inconvenient so I hope there is an easier way
With conda, you can create, export, list, remove, and update environments that have different versions of Python and/or packages installed in them. Switching or moving between environments is called activating the environment. You can also share an environment file.
To export the exact set of paths used by Anaconda, use the command echo %PATH% in Anaconda Prompt. This is needed to avoid problems with certain libraries such as SSL. Show activity on this post. Note that the execution policy of powershell must be set, e.g. using Set-ExecutionPolicy Unrestricted .
Question 1: do i have to activate the conda env every time i open command prompt? No, you do not have to activate conda every time you open CMD. This is simply a matter of choice for the developer.
When a conda
environment is activated, it will export
following related environment variables:
$CONDA_DEFAULT_ENV
, name of current activated env$CONDA_PREFIX
, path to the current activate envIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With