使用 cx_Freeze 在 .exe 中转换 .py 时出错

Error using cx_Freeze to turn .py in .exe

我在 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
)

如果需要我的程序代码请告诉我, 请帮助我,我不知道如何解决这个问题。

试一试:

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
)