First, clarify where your conda environment is installed. Here I take the conda environment installed in the directory /d/miniconda3 as an example.
Then add the following code to vim ~/.bashrc, where /d/miniconda3 is replaced by the conda environment location in your own environment.
__conda_setup="$('/d/miniconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/d/miniconda3/etc/profile.d/conda.sh" ]; then
. "/d/miniconda3/etc/profile.d/conda.sh"
else
export PATH="/d/miniconda3/bin:$PATH"
fi
fi
unset __conda_setup
After saving the changes, enter the following command to make the changes take effect immediately.
source ~/.bashrc
Expand: Expand:Extension:
The .bashrc file will load the content in the .bashrc file every time bash is started, and customize the current bash configuration and environment based on the content.
.bashrc is read every time a new terminal is opened.
The main uses of the .bashrc file:
1. Set the environment path
export PATH=/usr/local/cuda-11.6/bin:$PATH
2. Personalized instructions
alias rm='rm -i'