3

I have anaconda distribution installed on my macbook to my local home directory /Users/simon/anaconda

When I open up iterm and type python I see the default OSX install of python. I saw this thread here and implemented the fix mentioned: Mac using default Python despite Anaconda install

My .bash_profile currently looks like this:

export PATH="$HOME/anaconda/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$PATH"

A few strange things happen:

  1. When I type python I still see the OSX python despite having changed my .bash_profile
  2. If I source /Users/simon/.bash_profile this actually fixes the problem. Using python now brings up anaconda's python
  3. When I quit iterm or restart my computer and try to load python again, it goes back to the OSX version. .bash_profile remains unchanged.

When I try all of the above using terminal everything works fine. The issues described above appear to be specific to iterm2 and I'm not sure why

How do I get my system to use anacondas python instead of the OSX version?

Community
  • 1
  • 1
Simon
  • 9,762
  • 15
  • 62
  • 119
  • What's the output of `echo $HOME` ? – Thomas Ayoub Jan 28 '16 at 10:19
  • `/Users/simon` for both iterm and terminal – Simon Jan 28 '16 at 10:23
  • 1
    By any chances, do you have any `dotfile` installed ? could you `echo $PATH` before and after sourcing the `.bash_profile` ? – Thomas Ayoub Jan 28 '16 at 10:26
  • I do have a number of dotfiles (emacs, zsh etc). Before: `/anaconda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games` and after: `/Users/simon/anaconda/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/anaconda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games` – Simon Jan 28 '16 at 10:32
  • OK it turns out I was exporting a different PATH in my .zshrc file. I changed it to what was in my bash profile and it all works now...Are there any issues with exporting PATH in multiple places like that? – Simon Jan 28 '16 at 10:34

1 Answers1

2

It seems that your $PATH is redefined somewhere else in your configuration. This usually doesn't cause issue if you know in which order they are loaded and keep track of what's going on.

I recommend a bit of reading to understand more the load order.

Thomas Ayoub
  • 29,063
  • 15
  • 95
  • 142