[英]Creating single EXE using py2exe for a Tkinter program
我正在嘗試使用此鏈接上提供的minty解決方案為我的基於Tkinter的程序生成單個exe文件:
這是我在setup.py中寫的內容:
from distutils.core import setup
import py2exe, sys, os
sys.argv.append('py2exe')
setup(windows=[{'script': 'filename.py'}], \
options={"py2exe": {"includes": ["decimal", "Tkinter", \
"tkFileDialog", "csv", "xml.dom.minidom", "os"], \
'bundle_files': 1, 'compressed': False}}, \
zipfile = None)
它為Tkinter創建了一個'tcl'文件夾,即使我已經指定了bundle_files = 1.另外它還會生成一些其他的exe w9xpopen.exe。 但是,我的實際exe不會運行,也不會出現任何錯誤。 如果我刪除所有這些包含它甚至不起作用。
我對這里可能缺少什么的想法? 我正在使用64位Windows 7機器。
感謝此鏈接 ,您必須編輯site-packages/py2exe/build_exe.py
並將"tcl85.dll"
和"tk85.dll"
到dlls_in_exedir
列表中。 這將使它運行,雖然你仍然有tcl
文件夾,這兩個dll將在exe旁邊。 但它比bundle_files=3
更好。
self.dlls_in_exedir = [python_dll,
"w9xpopen%s.exe" % (is_debug_build and "_d" or ""),
"msvcr71%s.dll" % (is_debug_build and "d" or ""),
"tcl85.dll",
"tk85.dll"]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.