python - Installing matplotlib on Ubuntu: ImportError -


my platform:

ubuntu 13.04, python 2.7.4.

installing matplotlib failed, importerror: no module named pyplot.

i have tried many ways such as

$ sudo apt-get install python-matplotlib 

and easy install, install source..., i'm folllowing http://matplotlib.org/faq/installing_faq.html

but none of them works, importerror happen, can help?

edit trace back:

--------------------------------------------------------------------------- importerror                               traceback (most recent call last) <ipython-input-4-82be63b7783c> in <module>() ----> 1 import matplotlib  /home/wuhuijia/matplotlib.py in <module>()       1 import numpy np ----> 2 import matplotlib.pyplot plt       3 import scipy.optimize       4        5 def find_confidence_interval(x, pdf, confidence_level):  importerror: no module named pyplot 

your script named matplotlib.py. python first locally when importing modules, is, on directory itself. thus, python imports your script (and not installed matplotlib) when execute import matplotlib.pyplot, , since script has no submodule pyplot, fails.

rename script else (e.g., testmpl.py) , should fine.


Comments