我在python中有一个程序,我想使用cx_Freeze转向.exe,但它会出错,请按照图片: Here's the image
这是我的setup.py代码
import sys
from cx_Freeze import setup,Executable
import os.path
from tkinter import *
os.environ['TCL_LIBRARY'] = r'C:\Program Files\Python36\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'C:\Program Files\Python36\tcl\tk8.6'
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
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')
options = {
'build_exe': {
'include_files':[
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'),
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'),
],
},
}
base=None
if sys.platform=='win32':
base='Win32GUI'
executables=[
Executable('TABUADATKINTER.py',base=base)
]
buildOptions=dict(
packages=[],
includes=['pygame'],
include_files=[],
excludes=[]
)
setup(
name='Tabuada',
version='1.0',
description='TABUADA',
options=dict(build_exe=buildOptions),
executables=executables
)
告诉我是否需要我的程序代码, 请帮助我,我不知道如何解决这个问题。
答案 0 :(得分:0)
尝试一下:
from cx_Freeze import setup,Executable
import os.path
from tkinter import *
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
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')
packages = ["pygame"]
options = {
'build_exe': {
'include_files':[
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'),
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'),
],
'packages':packages,
},
}
base=None
if sys.platform=='win32':
base='Win32GUI'
executables=[Executable('TABUADATKINTER.py',base=base)]
setup(
name = 'Tabuada',
options = options,
version = "1.0",
description = 'TABUADA',
executables = executables
)