Ubuntu – Need to remove anaconda3 from $PATH

environment-variablespython

I imagine this is probably a duplicate, but I'm fairly new to Linux and all the other guides I've already checked seem to be referring to something different. I installed anaconda3 and accidentally told it to update the path variable. This is messing with all sorts of things for obvious reasons. When I which python I get /home/sbendl/anaconda3/bin/python,

and if I echo $PATH I get:

 /home/sbendl/anaconda3/bin:/opt/ros/kinetic/bin:/home/sbendl/bin:/home/sbendl/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

but when I look at /etc/environment I don't see anything at all related to those. Clearly I'm confusing two different things. I would like to be able to continue using Python 3.5 when needed, but I want the default to be 2.7 so that I can use anything else that assumes 2.7.

Best Answer

To completely remove anaconda from your path:

  • Check for the anaconda entry in both ~/.bashrc and ~/.bash_profile and remove the line:

    export PATH="/home/sbendl/anaconda2/bin:$PATH"
    

For complete removal:

  • Remove the entries in the files stated above then get rid of the ~/anaconda2 dir.

And that should correct the issue.