python – How can I upgrade NumPy?
python – How can I upgrade NumPy?
When you already have an older version of NumPy, use this:
pip install numpy --upgrade
If it still doesnt work, try:
pip install numpy --upgrade --ignore-installed
Because we have two NumPy installations in the system. One is installed by Homebrew and the second is installed by pip. So in order to solve the problem, we need to delete one and use the default NumPy install by OpenCV.
Check the path,
import numpy
print numpy.__path__
and manually delete it using rm
.
python – How can I upgrade NumPy?
The error you mentioned happens when you have two versions of NumPy on your system. As you mentioned, the version of NumPy you imported is still not upgraded since you tried to upgrade it through pip (it will upgrade the version existing in /Library/Python/2.7/site-packages
).
However Python still loads the packages from /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy
where the pre-installed packages live.
In order to upgrade that version you have to use easy_install
. The other way around this problem is using virtualenv
and setting up a new environment with all the requirements you need.