I have installed numpy 1.8. But when I do print numpy.__version__
it says 1.6.
What do I have to change to get python to realize where numpy is? Working on a Mac (10.9). I'm using python 2.7.6.
Edit:
I've tried to delete all my versions of numpy. I did pip uninstall numpy. And then I typed:
python import numpy print numpy.version
and it printed out 1.6.2
I can't delete numpy apparently.
I am running Python 2.7.5 on Mac OS X 10.9.4, and this appears to be some kind of weird bug in how the Macintosh factory-installed version of Python is handling upgraded package installations.
In my case, when I do:
sudo pip uninstall numpy
it removes the version of numpy installed under
/Library/Python/2.7/site-packages
However, this does not mean that numpy is fully removed from the system! There are a second set of "backup" versions of several Python packages installed also at:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
When I install numpy using the /usr/bin/easy_install
utility that Apple shipped with the OS X system, the latest version (currently at 1.9.0, as of this posting) of numpy is loaded into Library/Python/2.7/site-packages
, just as one would expect, and it correctly precedes the "OS X system default" version of numpy in the module load path so that the latest version of numpy is loaded when I do import numpy
in Python. However--and this is the really weird, apparently buggy behavior!--when I uninstall numpy, and instead reinstall using either pip, or by doing:
sudo python setup.py install
on a .tar.gz distribution downloaded directly from sourceforge, the upgraded installation does not appear to take precedence in the Python module load path, even though it is also installed under /Library/Python/2.7/site-packages
!
Anyway, to fix the problem (or rather, I should probably say, to work around the bug, at least on Max OS X), follow this procedure:
/Library/Python/2.7/site-packages
using the method of your choice (pip uninstall numpy
appeared to work for me)/Library/Python/2.7/site-packages
/usr/bin/easy_install
. Do not use any other alternative method, at least not if you want to use numpy with the Apple factory-installed version of Python 2.7Alternatively, using a completely different distribution of Python (e.g., Canopy or Anaconda), as one of the other commenters already mentioned, should also work as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With