I would like to change the base install environment that initiates when I start a terminal to a different environment that I have created called myenv anaconda environment.

I want myenv to start every time I start the terminal.

I have turned off the base environment from initiating.

conda config --set auto_activate_base false 

I am on Ubuntu 20.04.

In my .bashrc file I already have a conda init at the end. I am not sure if I should anything with it.

# >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! __conda_setup="$('/home/MYUSERNAME/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/nul> if [ $? -eq 0 ]; then eval "$__conda_setup" else if [ -f "/home/MYUSERNAME/anaconda3/etc/profile.d/conda.sh" ]; then . "/home/MYUSERNAME/anaconda3/etc/profile.d/conda.sh" else export PATH="/home/MYUSERNAME/anaconda3/bin:$PATH" fi fi unset __conda_setup # <<< conda initialize <<< 
1

1 Answer

All you have to do is edit your ~/.bashrc file and add the following line at the end of it:

conda activate myenv 

You can also add it using this command:

echo "conda activate myenv" >> ~/.bashrc 

Don't comment out or remove the conda initialization block. Just put the conda command at the end of your .bashrc.

The content of ~/.bashrc is run every time you start a terminal, so adding the conda command activates your myenv environment when opening a new terminal.

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy