It is important to note that there are two different installations of Python on your Mac. There is the System Python (/usr/bin
), and also the /usr/local/bin
python.
There are also two installations of pip. For example:
$ which pip
/usr/local/bin/pip
$ ls -l /usr/local/bin/pip
lrwxr-xr-x 1 dmao admin 30 Feb 14 19:09 /usr/local/bin/pip -> ../Cellar/python/2.7.9/bin/pip
This is the homebrew pip. I assume you have numpy installed on the homebrew version of pip.
There is no System version of pip installed by default. The usual solution is to run easy_install pip
and install a system version of pip, then pip install numpy
(using system pip). However, you mentioned you wanted to leave the system numpy.
If you need to leave the system numpy untouched, you can run the /usr/local
Python as your default Python instead of the system Python. Here we create a symbolic link from the default python to the local python, so that the local python becomes the default.
sudo ln -s /usr/bin/python /usr/local/bin/python
Then your default Python version becomes the one which matches your default version of pip.
You can restore your default Python version anytime by replacing the symlink. /usr/bin has the links you need.
$ ls -l /usr/bin/ | grep python
lrwxr-xr-x 1 root wheel 76 Feb 21 2014 pythonw2.5 -> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/pythonw2.5
lrwxr-xr-x 1 root wheel 76 Feb 21 2014 pythonw2.6 -> ../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/pythonw2.6
lrwxr-xr-x 1 root wheel 76 Feb 21 2014 pythonw2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
Alternatively, if your System Python is being used for something, and/or you need to keep switching between versions of python packages, you could use virtualenv, which makes this much easier.
There are many different ways to manage python modules on a Mac. For example, What is the most compatible way to install python modules on a Mac?