Python安装时import matplotlib.pyplot as plt报错

安装matplotlib的时候可能会出现输入import matplotlib.pyplot as plt出现报错的现象,如下图所示:

>>> import matplotlib
>>> import numpy
>>> import scipy
>>> import pyparsing
>>> import matplotlib.pyplot as plt


Traceback (most recent call last):
  File "<pyshell#4>", line 1, in <module>
    import matplotlib.pyplot as plt
  File "C:\Python27\Lib\site-packages\matplotlib\pyplot.py", line 29, in <module>
    from matplotlib.figure import Figure, figaspect
  File "C:\Python27\Lib\site-packages\matplotlib\figure.py", line 36, in <module>
    from matplotlib.axes import Axes, SubplotBase, subplot_class_factory
  File "C:\Python27\Lib\site-packages\matplotlib\axes.py", line 20, in <module>
    import matplotlib.dates as _  # <-registers a date unit converter
  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

解决办法是:

把路径如:C:\Python27\Lib\site-packages\scipy\lib中的six.py six.pyc six.pyo三个文件拷贝到C:\Python27\Lib\site-packages目录下。

再在IDLE(Python GUI)中输入import matplotlib.pyplot as plt便可以解决啦!

如下所示:

>>> import matplotlib.pyplot as plt
>>> 


评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值