Installing Pylab/Matplotlib

I’m trying to write a program that plots a graph, which made me look into Matplotlib.

I found a tutorial that started out with this little program, that worked fine:

from pylab import *

def main():
    X = np.linspace(-np.pi, np.pi, 256, endpoint=True)
    C,S = np.cos(X), np.sin(X)
    plot(X,C)
    plot(X,S)
    show()

if __name__ == '__main__':
    main()

Then I tried to run it on another computer, where it did not work at all. I tried to download Pylab and Matplotlib. When I had installed Matplotlib it demanded something called dateutil, when I got dateutil it demanded something called six. I downloaded six, but it didn’t work properly.

It doesn’t feel like I’m on the right track. What should I do to get a proper installation?

EDIT:

I’m using Python 2.7 on Windows 7.

The error I get is

Traceback (most recent call last):
  File "C:\Users\Python\mscript\listdb2.py", line 19, in <module>
    from pylab import *
  File "C:\Python27\lib\site-packages\pylab.py", line 1, in <module>
    from matplotlib.pylab import *
  File "C:\Python27\lib\site-packages\matplotlib\pylab.py", line 226, in <module>
    import matplotlib.finance
  File "C:\Python27\lib\site-packages\matplotlib\finance.py", line 21, in <module>
    from matplotlib.dates import date2num
  File "C:\Python27\lib\site-packages\matplotlib\dates.py", line 119, in <module>
    from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY,
  File "C:\Python27\lib\site-packages\dateutil\rrule.py", line 18, in <module>
    from six import advance_iterator, integer_types
ImportError: No module named six

The file six.py is located in C:\python27\Lib\site-packages\six\six.py

The six directory also contains a file called test_six.py. If I try to run this program I also get an error:

Traceback (most recent call last):
  File "test_six.py", line 5, in <module>
    import.py
ImportError: No module named py

Leave a Comment