2

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.

4
  • The version of pip is tied to a specific Python installation. So pip on my computer works for Python 3.7, while pip2 is for Python 2.7. Are you sure you're using the correct version of pip. Commented Feb 14, 2019 at 5:06
  • @bnaecker I am using pip3, I think this is the issue. My computer doesn't seem to recognize 'pip2'. How can I run install numpy using pip2? Commented Feb 14, 2019 at 5:11
  • It may just be called pip on your machine. If you do pip --version, that will tell you exactly which version. It may also be called pip2.7 or something more specific. Commented Feb 14, 2019 at 5:13
  • Okay, thanks! I'll try that Commented Feb 14, 2019 at 5:24

3 Answers 3

3

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
Sign up to request clarification or add additional context in comments.

Comments

0

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

0

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)

1 Comment

If you only want to use python27, you can also set it default globally by editing Environment Variables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.