This is a method to turn off the conda command and enable it with the conda command. It is a condition that anaconda is installed.
In .bashrc, .zshrc
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/user/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/user/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/user/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/user/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
There should be something like. It
function conda(){
unset -f conda
When
}
Let's surround it with.
function conda(){
unset -f conda
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/user/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/user/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/user/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/user/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
}
I defined a conda function so that I can start conda.
Type conda to call this function.
After calling, unset this function with unset -f conda
.
I wrote it during class, so please forgive me though it is a rough article.
Recommended Posts