我能够生成* .dat文件。发布当我尝试使用mprof绘制图形时,它会抛出异常:
vikas@server:~/memory_profiler-0.36$ ./mprof plot --output=plot.png
Using last profile data.
Traceback (most recent call last):
File "./mprof", line 494, in <module>
actions[get_action()]()
File "./mprof", line 454, in plot_action
pl.figure(figsize=(14, 6), dpi=90)
File "/usr/lib/pymodules/python2.7/matplotlib/pyplot.py", line 423, in figure
**kwargs)
File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 79, in new_figure_manager
return new_figure_manager_given_figure(num, figure)
File "/usr/lib/pymodules/python2.7/matplotlib/backends/backend_tkagg.py", line 87, in new_figure_manager_given_figure
window = Tk.Tk()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1767, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable
我在ubuntu托管的VM上运行此命令。
答案 0 :(得分:1)
这似乎是matplotlib的一个问题。您可以尝试在matplotlibrc文件中将后端更改为Agg(以便保存文件而不是显示结果):
http://matplotlib.org/users/customizing.html