我正在尝试从matplotlib文档中运行contourf示例.当我从python shell运行它时,一切运行良好,但是当我将它作为脚本(python contourf_demo.py)运行时,会出现以下错误:
Traceback(最近一次调用最后一次):
文件"matplotlib.py",第3行,in
将matplotlib.pyplot导入为plt
文件"/home/user/dir/contourf_demo.py",第3行,in
将matplotlib.pyplot导入为plt
ImportError:没有名为pyplot的模块
我正在使用Ubuntu 12.04,导入问题时:
将matplotlib.pyplot导入为plt
我尝试使用不同的方法来调用导入(例如来自matplotlib import pyplot),但它既不起作用.