1

I have ubuntu 12.10. I tried to install several packages for python like numpy, scipy and matplotlib. I ran the command:

sudo apt-get install python-numpy python-scipy python-matplotlib

But when I try to import matplotlib on python's (3.2) shell (or even numpy and scipy), I get an error like

>>> import numpy
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import numpy
ImportError: No module named 'numpy'

Yet, I tried to lauch python on the linux shell and import the modules: there is no problem there...

Why can I import the modules on python 2.x and not on 3.x?

1 Answer 1

2

You installed the packages for python 2.x. Do:

sudo apt-cache search numpy | grep 3

You will get a number of packages listed. From these, on my ubuntu, I would select:

sudo apt-get install python3-numpy

Sign up to request clarification or add additional context in comments.

2 Comments

this worked pretty good for numpy and scipy. However, I still can't use matplotlib. I tried installing it through pip (pypi.python.org/pypi/pip) and upgrading my system, but I can't import it on python 3...
do not have experience with installing it myself, but seems not quite trivial on 12.10: (joat-programmer.blogspot.com/2012/11/…)

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.