How can I upgrade Numpy in just one version of Python?
14,137
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
Author by
Bob Samuels
Updated on June 04, 2022Comments
-
Bob Samuels almost 2 years
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.
-
bnaecker about 5 yearsThe version of
pip
is tied to a specific Python installation. Sopip
on my computer works for Python 3.7, whilepip2
is for Python 2.7. Are you sure you're using the correct version ofpip
. -
Bob Samuels about 5 years@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?
-
bnaecker about 5 yearsIt may just be called
pip
on your machine. If you dopip --version
, that will tell you exactly which version. It may also be calledpip2.7
or something more specific. -
Bob Samuels about 5 yearsOkay, thanks! I'll try that
-
-
Shariq about 5 yearsIf you only want to use python27, you can also set it default globally by editing Environment Variables.