Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
943 views
in Technique[技术] by (71.8m points)

matplotlib - Python Error: "ImportError: No module named six"

I am running Python 2.7 on a Windows 7 OS

Here is what I run:

>>> import matplotlib.pyplot as plt

Then I get this:

Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    import matplotlib.pyplot as plt
  File "C:Python27libsite-packagesmatplotlibpyplot.py", line 29, in <module>
    from matplotlib.figure import Figure, figaspect
  File "C:Python27libsite-packagesmatplotlibfigure.py", line 36, in <module>
    from matplotlib.axes import Axes, SubplotBase, subplot_class_factory
  File "C:Python27libsite-packagesmatplotlibaxes.py", line 20, in <module>
    import matplotlib.dates as _  # <-registers a date unit converter
  File "C:Python27libsite-packagesmatplotlibdates.py", line 119, in <module>
    from dateutil.rrule import (rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY,
  File "C:Python27libsite-packagesdateutil
rule.py", line 18, in <module>
    from six import advance_iterator, integer_types
ImportError: No module named six

Now, I have downloaded six from here : https://pypi.python.org/pypi/six

I unzipped it and if I open up a file from there called setup.py and then I try to import matplotlib then it works, but I don;t have to do this every time I want to make a plot do I? Isn't there a way to get this to work automatically?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You need to install it on your system. This basically means putting the zip file where Python can find it, but by far the easiest way is pip install six. This will download it a second time, though.

Like the matplotlib installation instructions mention, six is a dependency of the dateutil package. Most sane installation methods would pull in this dependency automatically; if you had done pip install python-dateutil in the first place, this missing dependency should have been satisfied behind the scenes. If you require a completely manual installation, you should give those instructions a thorough read.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...