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?

kgf3JfUtW
  • 13,702
  • 10
  • 57
  • 80
bigTree
  • 2,103
  • 6
  • 29
  • 45

1 Answers1

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

ondrejdee
  • 476
  • 2
  • 8
  • this worked pretty good for numpy and scipy. However, I still can't use matplotlib. I tried installing it through pip (https://pypi.python.org/pypi/pip) and upgrading my system, but I can't import it on python 3... – bigTree Jul 02 '13 at 14:47
  • 1
    do not have experience with installing it myself, but seems not quite trivial on 12.10: (http://joat-programmer.blogspot.com/2012/11/install-matplotlib-on-ubuntu-1210-for.html) – ondrejdee Jul 02 '13 at 14:56