A lot is going on here.
Essentially, the Python that you use in your IDE is not the Python that you use in the terminal. This is why pip install doesn't put things in the right place.
The simplest solution is to change the $PATH environment variable so that when you type python in the terminal, you get the same version as your IDE. I suppose your python IDE will be something like /Applications/Spyder-Py2.app/Contents/Resources/bin/python , in which case you will get rid of your PYTHONPATH by setting your .bash_profile and add:
export PATH="/Applications/Spyder-Py2.app/Contents/Resources/bin:$PATH"
Assuming pip available in the same place, you should now pip install use things without having to cheat with PYTHONPATH .
Another problem is that the environment variables set in the shell, for example in your .bash_profile , do not affect the environment visible to applications. You can set environment variables that will be visible to OS X applications (for example, see this question ), but this is complicated, and I would not recommend this.
An alternative solution, if available, is to simply tell your IDE that python should use, and specify it depending on what is visible from the terminal.
source share