我正在使用py2exe将我的脚本编译成一个在Windows上运行的exe文件,但是我的操作系统是基于我的操作系统,即Window 7 x64。我正在使用execmaker.py py2exe
在cmd中运行以下脚本:
from distutils.core import setup
import py2exe
includes = []
excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger',
'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
'Tkconstants', 'Tkinter']
packages = []
dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll',
'tk84.dll']
setup(
options = {"py2exe": {"compressed": 2,
"optimize": 2,
"includes": includes,
"excludes": excludes,
"packages": packages,
"dll_excludes": dll_excludes,
"bundle_files": 1,
"dist_dir": "dist",
"xref": False,
"skip_archive": False,
"ascii": False,
"custom_boot_script": '',
}
},
windows=['My_Script.py'] #this is the name of the script I'm compiling to exe
)
我正在编译成exe的实际脚本并不重要,因为当我使用bundle_files: 3,
编译它时它完全正常,它不捆绑任何文件并在文件夹中留下~200 .pyo文件。
让我们来看看问题的中心:当我在Win 7 x64上时,我安装了64位版本的Python 2.7.5。当我cd
到execmaker.py
和My_Script.py
文件所在的文件并在cmd(execmaker.py py2exe
)中运行时,我得到一条错误消息,如下所示:error: bundle-files 1 is not yet supported on win64
,我认为它不会捆绑文件,因为我的操作系统是64位。我想也许这是一个问题,因为我安装了64位python,但是当我卸载它时,我收到了错误DLL load failed: %1 is not a valid Win32 application.
DLL加载错误是由64位Windows上运行32位python引起的。所以基本上,它不适用于32位或64位python,因为我正在运行64位Windows。有没有解决方法,或者我是否需要安装python和我在32位机器上使用的所有模块来进行编译?
感谢您的帮助,并通过这个非常长的问题与我联系。
编辑 - 解决方案:我做了更多的研究,没有提出任何建议。现在,除非用更有效的方法回答这个问题,我想在分区上或通过Parallels安装一个32位操作系统(我就是这样做的)就足够了。