Hi I have a Mac and happen to have many different flavors of Python installed everywhere.
right now when I opened up python in terminal, type in
which python
the return result is:
//anaconda/bin/python
I am wondering what should I do to change the default python to a python that I like, so next time when I do:
which python
the path should be:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Thanks!
3 Answers 3
When you installed Anaconda it should have added a new item to your PATH variable, right at the front. You should see something like this in your *~/.bash_profile* file:
# added by Anaconda 1.8.0 installer
export PATH="//anaconda/bin:$PATH"
You can remove these lines, reopen any terminal window you have and your default Python should have been restored.
Comments
which command uses the directories listed in $PATH to search for the first occurrence of a command. If you want to list all instances of executables, use -a option.
which python2.7
Output:
/usr/bin/python2.7
This will display symbolic link to /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
to resolve symbolic link use
readlink $(which python2.7)
output:
../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
2 Comments
Try creating a symbolic link
ln -s /anaconda/bin/python /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
.bash_profilefile.