2017-10-11 115 views
0

我在windows10中編寫了一個python 3.6.2程序,我將它轉換成Cx_Freeze.i的.exe文件,寫下了波紋管代碼來轉換它: from cx_Freeze import設置,可執行該文件的版本與Windows版本不兼容

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

您的Python版本是32位還是64位? –

+0

@Michael Butscher它是64位。 – naghi

回答

2

cx_freeze將Python和二進制模塊打包到最終的程序中,因此它變成了64位的exe文件,無法在32位操作系統下運行。

安裝一個32位Python,並使用它與cx_freeze一起創建一個工作程序。