I\'ve installed Python Numpy on Debian using...
apt-get install python-numpy
But when run the Python shell I get the following..
As you can tell from your which
result, the python you are running when just typing python
is /usr/local/bin/python
.
It's a python you probably installed there yourself, as Debian will never put anything in /usr/local by itself (except for empty directories).
How? Well, by running pip
for instance. As a rule, you should never use pip
outside of a virtualenv, because it will install stuff on your system that your package manager will not know about. And maybe break stuff, like what you see on your system.
So, if you run /usr/bin/python
, it should see the numpy package you installed using your package manager.
How to fix it? Well, I would clear anything in /usr/local
(beware, it will definitely break stuff that rely on things you installed locally). Then I would apt-get install python-virtualenv
, and always work with a virtualenv.
$ virtualenv -p /usr/bin/python env
$ . env/bin/activate
(env)$ pip install numpy
(env)$ python
>>> import numpy
>>>
That way, packages will be installed in the env
directory. You do all this as a regular user, not root. And your different projects can have different environments with different packages installed.