I am trying to get OpenCV working, but the issue with this is that my Python27 Numpp version is too old. Every time I write "install --upgrade numpy", I am told that Numpy is already up to date in C:Python37. How can I update Numpy in C:Python27 rather than 37? Any help would be much appreciated.
3 Answers
Forgive me as I am on a mac, but I think a similar command should work on windows:
<path/to/particular/version/of/python> -m pip install numpy==<version number>
As an example from my machine:
$ # numpy versions before changes
$ python3.6 -m pip list | grep numpy
numpy 1.14.5
$ python3.7 -m pip list | grep numpy
numpy 1.15.2
$ # updating numpy for python3.6
$ python3.6 -m pip install numpy==1.16.1
.
.
.
$ # numpy versions after changes
$ python3.6 -m pip list | grep numpy
numpy 1.16.1
$ python3.7 -m pip list | grep numpy
numpy 1.15.2
Comments
I assume you are running pip install --upgrade numpy
Try where pip and where python to get an idea of which version of python your are executing pip from. Use which pip instead on Mac or Linux.
I assume it will return c:\python27\Scripts\pip.exe if so then try...
c:\python27\Scripts\pip.exe install --upgrade numpy
Comments
Extending the first answer by JCutrer, after installing numpy on the specified version, you need to run the python.exe interpreter of the specified version.
So, assuming you did
c:\python27\Scripts\pip.exe install --upgrade numpy, the libraries have been installed for python27, now you can run python from the below path, or set this path as interpreter in your IDE.
c:\python27\bin\python27.exe (or python.exe)
pipis tied to a specific Python installation. Sopipon my computer works for Python 3.7, whilepip2is for Python 2.7. Are you sure you're using the correct version ofpip.pipon your machine. If you dopip --version, that will tell you exactly which version. It may also be calledpip2.7or something more specific.