Thursday, April 25, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 94756  / 3 Years ago, mon, november 1, 2021, 6:38:14

I have been through the process of installing matplotlib on my Ubuntu 12.04 computer. However, when I try to run a test program, I get the following error:



Traceback (most recent call last):
File "../py33/test.py", line 2, in <module>
import matplotlib.pyplot as plt
ImportError: No module named 'matplotlib'


I am trying a sample program from matplotlib's website (basic_example). I just don't understand why it says there is not module matplotlib, even though I have definitely installed it (using sudo apt-get install python-matplotlib, and have done sudo apt-get build-dep python-matplotlib; I also tried pip install matplotlib, as I was told to do that, after installing Python itself, if I wanted to install other binaries).


More From » 12.04

 Answers
3

I believe you are using python3. So in order to run your script you need either to use python2.x or to make sure you have matplotlib v1.2 or higher. This is because matplotlib does not support python3 before v1.2.



I am using matplotlib v1.1 with python2.7 and I have no problem. I tried to do a simple import matplotlib with python3 and it gives the same error as you.


[#26755] Monday, November 1, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
afyess

Total Points: 437
Total Questions: 120
Total Answers: 107

Location: San Marino
Member since Fri, Jul 3, 2020
4 Years ago
afyess questions
;