sublime text 运行python代码,图形无显示

来源:互联网 发布:sql 格式化 java代码 编辑:程序博客网 时间:2024/06/07 00:42

sublime text 2 中运行:

import matplotlib.pyplot as pltplt.plot([1,1,1,1])plt.show() 

图片显示不出来


解决方案:

进入:Preferences→Browse Packages, 打开exec.py文件,在第26行中有:

        startupinfo = None        if os.name == "nt":            startupinfo = subprocess.STARTUPINFO()            #startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW

最后一行是自己注释的,只要注释了这一行就能出现图形了。


参考:http://ptomato.wordpress.com/2012/02/09/geek-tip-running-python-guis-in-sublime-text-2/