我在windows10中的python 3.6.2中编写了一个程序,我将它转换为.exe文件,由Cx_Freeze.i编写以下代码来转换它: 来自cx_Freeze导入设置,可执行文件
import os
import sys
os.environ['TCL_LIBRARY'] = r'C:\Users\seyed_vahid\AppData\Local\Programs\Python\Python36\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'C:\Users\seyed_vahid\AppData\Local\Programs\Python\Python36\tcl\tk8.6'
packages = ['idna','queue.py']
include_files=[r'C:\Users\seyed_vahid\AppData\Local\Programs\Python\Python36\DLLs\tcl86t.dll',r'C:\Users\seyed_vahid\AppData\Local\Programs\Python\Python36\DLLs\tk86t.dll',r'C:\Users\seyed_vahid\AppData\Local\Programs\Python\Python36\sticker.png',r'C:\Users\seyed_vahid\AppData\Local\Programs\Python\Python36\about.png',r'C:\Users\seyed_vahid\AppData\Local\Programs\Python\Python36\emoji1.png',r'C:\Users\seyed_vahid\AppData\Local\Programs\Python\Python36\telegram.png']
base = None
if (sys.platform == "win32"):
base = "Win32GUI"
setup(name = "MegaGram",
version = "1.0.0",
description = "MegaGram",
options = {'build_exe': {'packages':packages,
'include_files':include_files}},
executables = [Executable("MegaGram.py",base=base,icon = 'icon.ico',)],
)
但是当在Windows 7(32位)中运行exe文件时,我得到以下错误:
The version of this file is not compatible with the version of windows you are running cheak your computers system information to whethers you need an x86 or x64 version of the program,and then
contact the software publisher.
如何解决?
答案 0 :(得分:2)
cx_freeze将Python和二进制模块打包到最终程序中,因此它成为64位exe,无法在32位操作系统下运行。
安装32位Python并将其与cx_freeze一起用于创建工作程序。