which is the best way to setup a conda init directly into a specific conda virtualenv within linux (and not the base one)?
I noticed that there is no conda init additional parameter to specify a env.
My attempts to edit ./bashrc were not effective
The original script is
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/conda/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/conda/etc/profile.d/conda.sh" ]; then
. "/opt/conda/etc/profile.d/conda.sh"
else
export PATH="/opt/conda/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
The envs are under /opt/conda/envs/.../bin/
I do not recommend editing the conda initialize
code section.
Rather,
Disable base auto-activation (once only, not in .bashrc
):
conda config --set auto_activate_base false
Add activation of the desired environment to the end of .bashrc
(or similar):
conda activate my_env