swagrov
swagrov

Reputation: 1450

Python is using the wrong version of Numpy module

I'm trying to use Numpy 1.11.1 for Python 2.7. I have Mac El Capitan, so sudo pip install doesn't work.

I decided to install Homebrew and do brew install python and that worked. If I use pip show numpy it shows that I have Numpy 1.11.1 now.

But if I run python -c 'import numpy; print numpy.version.version' I still get 1.8.0rc1 which is the old version I was trying to upgrade!

How do I use the correct numpy module? I would like to do this in a way that doesn't require adding in a line to the python scripts that call numpy, but if that's the only way then I'll do it.

info:

which pip
/Library/Frameworks/Python.framework/Versions/3.5/bin/pip
which pip
/Library/Frameworks/Python.framework/Versions/3.5/bin/pip
which pip2
/usr/local/bin/pip2
which pip3
/Library/Frameworks/Python.framework/Versions/3.5/bin/pip3
which python
/usr/bin/python
which python2
which python2.7
/usr/bin/python2.7
which python3
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3
which python3.5
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5

Upvotes: 5

Views: 3014

Answers (1)

Laurent LAPORTE
Laurent LAPORTE

Reputation: 22942

It's better to use a virtualenv to install the required libraries version. Don't pollute your system Python.

It will solve your problem…

mkdir $HOME/virtualenv
cd $HOME/virtualenv
virtualenv my_app
source my_app/bin/activate
pip install the_lib==x.y.z

Where the_lib is numpy and x.y.z is the version 1.11.1.

Upvotes: 1

Related Questions