Python 正在运行由cx\U Freeze生成的可执行文件,出现回溯错误
这是我的setup.py文件,用于cx\U冻结Python 正在运行由cx\U Freeze生成的可执行文件,出现回溯错误,python,cx-freeze,traceback,Python,Cx Freeze,Traceback,这是我的setup.py文件,用于cx\U冻结 import sys from cx_Freeze import setup, Executable import os os.environ['TCL_LIBRARY'] = r"C:\Users\Admin\AppData\Local\Programs\Python\Python35-32\tcl\tcl8.6" os.environ['TK_LIBRARY'] = r"C:\Users\Admin\AppData\Local\Program
import sys
from cx_Freeze import setup, Executable
import os
os.environ['TCL_LIBRARY'] = r"C:\Users\Admin\AppData\Local\Programs\Python\Python35-32\tcl\tcl8.6"
os.environ['TK_LIBRARY'] = r"C:\Users\Admin\AppData\Local\Programs\Python\Python35-32\tcl\tk8.6"
build_exe_options = {"packages":["os"], "includes" : ["tkinter"]}
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup(name='APS West Email Generator',
version='1.0',
description='Auto generates Alarm notification emails. And maybe more in the future.',
options = {"build_exe": build_exe_options},
executables = [Executable("Tool_EmailGenerator.py", base=base)])
生成的可执行文件没有错误。但当我尝试运行它时,会出现以下窗口:
标题:cx\U冻结:主脚本中出现Python错误
内容:
回溯(最近一次呼叫最后一次):
文件
“c:\Users\Admin\AppData\Local\Programs\Python\Python 35-32\lib\site packages\cx\u Freeze\initscripts\uuuuuu startup\uuuuuuu.py”,第12行,在导入中(name+“init”)
文件
“c:\Users\Admin\AppData\Local\Programs\Python35-32\lib\site packages\cx\u Freeze\initscripts\Console.py”,scriptModule=导入(moduleName)中的第21行
文件“Tool_EmailGenerator.py”,第2行,在
文件
“c:\Users\Admin\AppData\Local\Programs\Python35-32\lib\tkinter\uuuuu init\uuuuuuuuuu.py”,中的第35行
import_tkinter#如果失败,您的python可能没有配置为Tk
ImportError:DLL加载失败:找不到指定的模块
tkinter在我运行py文件pre-cx\u Freeze时工作。我在网上搜索过,尝试过各种建议。到目前为止,一切都不起作用。我不确定是什么原因造成的 已成功解决此问题。 而不是做: “包括”:[“tkinter”], 我把tkinter添加到包中。 所以:“软件包”:[“os”,“tkinter”]
这似乎奏效了现在,在正确的目录下运行“python setup.py build”时,我遇到了一个错误。现在它无法建造。它抛出了一个ImportError,没有从cx\u Freeze\finder.py中引发名为“tkinter”的模块导入错误。昨晚没有发生这种情况。我想不出我能做些什么来打破它。我完成了python的卸载。所有这些。从注册表项和系统路径中删除。重新安装python 3.5 64位。我也收到了同样的提示:DLL加载失败。已设法解决此问题。我没有执行“includes”:[“tkinter”],而是将tkinter添加到包中。所以:“软件包”:[“os”,“tkinter”]。这似乎奏效了。