ChatGPT解决这个技术问题 Extra ChatGPT

How to uninstall Anaconda completely from macOS

How can I completely uninstall Anaconda from MacOS Sierra and revert back to the original Python? I have tried using conda-clean -yes but that doesn't work. I also remove the stuff in ~/.bash_profile but it still uses the Anaconda python and I can still run the conda command.

haha no way you went to an almost 2 year old post to mark it as duplicate
how does one uninstall conda if in addition it cannot find the conda command but the directory still exists?
see this: docs.anaconda.com/anaconda/install/uninstall you might have to "macOS Open the Terminal.app or iTerm2 terminal application, and then remove your entire Anaconda directory, which has a name such as anaconda2, anaconda3, or ~/opt. Enter rm -rf ~/anaconda3 to remove the directory. " or run conda install anaconda-clean; anaconda-clean --yes

K
Kalanos

To remove the configs:

conda install anaconda-clean
anaconda-clean --yes

Once the configs are removed you can delete the anaconda install folder, which is usually under your home dir:

rm -rf ~/anaconda3

Also, the anaconda-clean --yes command creates a backup in your home directory of the format ~/.anaconda_backup/<timestamp>. Make sure to delete that one also.

EDIT (v5.2.0): Now if you want to clean all, you will also have to delete the two last lines added to your .bash_profile. They look like:

# added by Anaconda3 5.2.0 installer
export PATH="/Users/ody/anaconda3/bin:$PATH"

Here is an official link to Anaconda for more information.
rm -rf ~/anaconda2 is for Mac. For Windows–In the Control Panel, choose Add or Remove Programs or Uninstall a program, and then select Python 3.6 (Anaconda) or your version of Python.
Out of curiosity, what does simple rm leave that anaconda-clean --yes gets rid of?
Great guide, but with a small typo - the default installation location for Anaconda is the root folder, not the home folder. Thus, rm -rf ~/anaconda3 will fail silenty, i.e., run without actually deleting anything. The correct command is sudo rm -rf /anaconda3 or sudo rm -rf /anaconda2 depending on the Anaconda version installed.
I don't know why but just in case someone is suffering like me for some reason it was in this location /Users/brandBrandoParetoopareto/opt/ so I did /Users/brandBrandoParetoopareto/opt/miniconda3
g
gogasca

To uninstall Anaconda open a terminal window:

Remove the entire anaconda installation directory:

rm -rf ~/anaconda

Edit ~/.bash_profile and remove the anaconda directory from your PATH environment variable.

Note: You may need to edit .bashrc and/or .profile files instead of .bash_profile

Remove the following hidden files and directories, which may have been created in the home directory: .condarc .conda .continuum

Use:

rm -rf ~/.condarc ~/.conda ~/.continuum

Note to newbies: may need to edit .bashrc and/or .profile instead
As DeltaIV stated above; this will fail. At least did so for me: "Great guide, but with a small typo - the default installation location for Anaconda is the root folder, not the home folder. Thus, rm -rf ~/anaconda3 will fail silenty, i.e., run without actually deleting anything. The correct command is sudo rm -rf /anaconda3 or sudo rm -rf /anaconda2 depending on the Anaconda version installed."
L
Laknath

In my case (Mac High Sierra) it was installed at ~/opt/anaconda3.

https://docs.anaconda.com/anaconda/install/uninstall/


F
Fatemeh Asgarinejad

The following line doesn't work?

rm -rf ~/anaconda3 

You should know where your anaconda3(or anaconda1, anaconda2) is installed. So write

which anaconda

output

output: somewhere

Now use that somewhere and run:

rm -rf somewhere 

E
Emil Carpenter

MacOS Big Sur and MacOS High Sierra differ: the anaconda folder is ~/opt/anaconda3 instead of ~/anaconda3, according to the comment by jmgonet and answer by Laknath.

Install the cleaner

me@host:~$ conda install anaconda-clean

Activate the 'base' virtual environment

me@host:~$ source ~/anaconda3/bin/activate

Run the cleaner

(base) me@host:~$ anaconda-clean --yes

Deactivate the 'base' virtual environment

(base) me@host:~$ conda deactivate

Remove the files

me@host:~$ rm -rf ~/anaconda3
me@host:~$ rm -rf ~/.anaconda_backup

Delete lines added by conda from environment file(s)

Open the .bashrc file (and/or .profile and/or .bash_profile)

nano .bashrc

Search for conda:

press CTRL+W type conda press ENTER

Remove everything that looks like it has been added by/for anaconda:

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

This was done on Ubuntu 18.04 and will probably also work on MacOS.


I've just tested it on a Mac OS Big Sur. It works very well, with only one modification: the Anaconda folder is ~/opt/anaconda3. Thanks.
Thanks @jmgonet! I added the info at the top of my answer, with a credit to you.
i
ilam engl

Open the terminal and remove your entire Anaconda directory, which will have a name such as “anaconda2” or “anaconda3”, by entering the following command: rm -rf ~/anaconda3. Then remove conda with command conda uninstall see https://conda.io/docs/commands/conda-uninstall.html.


When running conda uninstall I get CondaValueError: Value error: no package names supplied, try "conda remove -h" for more details
write echo $PATH in your terminal to check if there is some reference to anaconda, if there is use export PATH="/path/you/want/to/keep"
e
evagreen

This has worked for me:

conda remove --all --prefix /Users/username/anaconda/bin/python

then also remove from $PATH in .bash_profile


This is a nice idea, but according to the documentation, this is meant for removal of conda environments. Here is the way Anaconda suggests: using anaconda-clean
j
jstamis

This is one more place that anaconda had an entry that was breaking my python install after removing Anaconda. Hoping this helps someone else.

If you are using yarn, I found this entry in my .yarn.rc file in ~/"username"

python "/Users/someone/anaconda3/bin/python3"

removing this line fixed one last place needed for complete removal. I am not sure how that entry was added but it helped


r
riot

After performing the very helpful suggestions from both spicyramen & jkysam without immediate success, a simple restart of my Mac was needed to make the system recognize the changes. Hope this helps someone!


Н
Некто

None of these solutions worked for me. Turns out I had to remove all the hidden files that you can reveal with ls -a My .zshrc file had some anaconda references in it that needed to be deleted


S
StOchastiC_

Adding export PATH="/Users/<username>/anaconda/bin:$PATH" (or export PATH="/Users/<username>/anaconda3/bin:$PATH" if you have anaconda 3) to my ~/.bash_profile file, fixed this issue for me.


I think you misunderstand the question. The question is how to uninstall Anaconda, not fix it. What you're suggesting here is a fix for keeping/installing Anaconda, not removing it
g
ghostyusheng

unset your ~/.bash_profile's PYTHONPATH and PYTHONHOME

(ps: when you debug Arduino, you may have set those vars. It would confuse the conda's env)


C
Charlie Parker

The official instructions seem to be here: https://docs.anaconda.com/anaconda/install/uninstall/

but if you like me that didn't work for some reason and for some reason your conda was installed somewhere else with telling you do this:

rm -rf ~/opt

I have no idea why it was saved there but that's what did it for me.

This was useful to me in fixing my conda installation (if that is the reason you are uninstalling it in the first place like me): https://stackoverflow.com/a/60902863/1601580 that ended up fixing it for me. Not sure why conda was acting weird in the first place or installing things wrongly in the first place though...


The ~/opt/ folder could include other installation folders as Homebrew, so you can't remove all the folders inside it.