尝试
setup.py如下修改您:
import sysfrom cx_Freeze import setup, Executableimport osPYTHON_INSTALL_DIR = os.path.dirname(sys.executable)os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')include_files = [(os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'), os.path.join('lib', 'tk86t.dll')), (os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'), os.path.join('lib', 'tcl86t.dll'))]base = Noneif sys.platform == 'win32': base = 'Win32GUI'executables = [Executable('SimpleTkApp.py', base=base)]setup(name='simple_Tkinter', version='0.1', description='Sample cx_Freeze Tkinter script', options={'build_exe': {'include_files': include_files}}, executables=executables)
这应该适用于
cx_Freeze版本5.1.1(当前版本)。在此版本中,包含的模块位于
lib构建目录的子目录中。如果使用5.0.1或更早版本,请设置
include_files = [os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'), os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll')]
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)