Python: cx_Freeze: 如果我点击 .exe 没有任何反应

Python: cx_Freeze: Noting happend if I click the .exe

双击 test.exe.....

没有任何反应

但是从头开始,我创建了一个 python 小程序,它位于 test.py:

test.py:

import tkinter 
top = tkinter.Tk()
top.mainloop()`

然后我使用 cx_Freeze 将 test.py 转换为 exe: 以下几行在我的 Setup.py:

import sys
from cx_Freeze import setup, Executable
import os
build_exe_options = {"packages": ["tkinter"], "include_files":[r"C:\Program
Files\Python36\tcl\tcl8.6",
         r"C:\Program Files\Python36\tcl\tk8.6"]}
os.environ['TCL_LIBRARY'] = "C:\Program Files\Python36\tcl\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\Program Files\Python36\tcl\tk8.6" 
base = None
if sys.platform == "win32":
    base = "Win32GUI"    `      
setup(  name = "stest",
    version = "1.0",description = "hello",
    options = {"build_exe": build_exe_options},
    executables = [Executable("test.py", base='Win32GUI')])`

然后我打开 cmd 并输入以下内容“python setup.py build”。构建时没有出现错误。

但是如果我点击 test.exe 没有任何反应。

我的错误在哪里?

不要通过 "pip install cx_freeze" 安装 cx_freeze,因为将安装旧版本,

而是转到 https://pypi.python.org/pypi/cx_Freeze,然后下载正确的版本。

例如使用pip install cx_Freeze-6.0b1-cp36-cp36m-win_amd64.whl.

最后将文件"tcl86t.dll"和"tk86t.dll"复制到构建文件夹