wangge
wangge

Reputation: 145

What should be changed in the .bash_profile file to delete/uninstall Conda/Anaconda completely?

So according to the official doc, we only need to delete the export path line. But it looks like all of the file is about conda. Can you also explain what is .bash_profile, can the file be deleted?

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

Upvotes: 2

Views: 1380

Answers (1)

merv
merv

Reputation: 76700

The conda init command adds these lines. If you haven't yet uninstalled the conda command, then one could use

conda init --reverse

which should delete whatever lines it had added to the .bash_profile or other resource files. These files are loaded by shells upon initialization whenever an interactive (e.g., bash -i) or login (e.g., bash -l) session is launched. Advanced users use these files to customize their interactive shell sessions with things like aliases, PATH and PS1 customizations, and specialized functions (sounds like OP does not have such customizations defined).

If the only thing in the file is what is between the lines:

# >>> conda initialize >>>
...
# <<< conda initialize <<<

then one can safely delete the file altogether.

Upvotes: 2

Related Questions