0

我无法导入 matplotlib

我可以通过命令提示符(python解释器)导入它但是当我在一个只有一行的程序中使用它时,import matplotlib as plt 我得到了这些错误

Traceback (most recent call last):
  File "D:\python\gis\test.py", line 1, in <module>
    import matplotlib as plt
  File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 133, in <module>
    from matplotlib.rcsetup import (defaultParams,
  File "C:\Python27\lib\site-packages\matplotlib\rcsetup.py", line 19, in <module>
    from matplotlib.colors import is_color_like
  File "C:\Python27\lib\site-packages\matplotlib\colors.py", line 54, in <module>
    import matplotlib.cbook as cbook
  File "C:\Python27\lib\site-packages\matplotlib\cbook.py", line 15, in <module>
    import new
  File "D:\python\gis\new.py", line 27, in <module>
    nx.draw(G, pos=pos)
  File "C:\Python27\lib\site-packages\networkx-1.7.dev_20120522142611-py2.7.egg\networkx\drawing\nx_pylab.py", line 114, in draw
    raise ImportError("Matplotlib required for draw()")
ImportError: Matplotlib required for draw()

我检查了它只包含 C:/python27 的路径,但不包含其他 python 目录 伙计们请帮帮我

4

1 回答 1

2

D:\python\gis\new.py模块正在遮蔽 Python 标准库模块。尝试重命名您的new模块。

于 2012-05-28T21:13:22.000 回答