【发布时间】:2011-02-01 03:44:34
【问题描述】:
我正在尝试使用 Py2exe 将 .py 文件转换为 .exe 文件。我的程序使用了 PIL 的几个模块
这是我从 PIL (sn-p) 导入的 .py 文件:
import Tkinter, re, random, struct
from PIL import ImageTk, Image, ImageDraw, ImageGrab
这是我用来将 .py 文件转换为 .exe 的代码:
from distutils.core import setup
import py2exe
setup(windows=[{"script": r'C:\Python26\blur.py'}],
options={r"py2exe":{r"includes": r'Tkinter',
r"includes": r'random',
r"includes": r're',
r"includes": r'struct',
r"includes": r'PIL',
}})
当我尝试运行我的 .exe 时出现问题。当我点击 .exe 时,程序无法启动。
我发现了这个: http://www.py2exe.org/index.cgi/py2exeAndPIL
但是,我不确定它的相关性。看到我的程序不加载任何文件格式的任何图像,而是使用 Image.new() 方法创建一个。
片段:
self.im = Image.new('RGB', (w, h), self.Hex )
这是在 Windows 7 中,如果它有所作为的话。
【问题讨论】:
标签: python tkinter python-imaging-library py2exe