不明错误.cx_freeze &特金特 [英] Unidentified error . cx_freeze & tkinter

查看:30
本文介绍了不明错误.cx_freeze &特金特的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 cx_freeze 将我的 py 文件转换为 .exe.发射时.它给了我错误

I converted my py file to .exe using cx_freeze. On launch. It gives me the error

https://www.upload.ee/image/7186947/Erir.PNG

我的 setup.py

MY setup.py

 from cx_Freeze import setup, Executable
 import os
 import sys
 import os.path

 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')

setup(
name = "Removed",
version = "3.5",
description = "Removed",
executables = [Executable(script = "test1.py", base = "Win32GUI")])

推荐答案

您的脚本中没有包含 Tk 和 tcl 运行时.

You have not included the Tk and tcl run-times with your script.

您应该使用 include_files 论证来包含它们.

You should use the include_files arguement to include them.

您只需要对脚本进行一些修改:

You just need to make a few modifications to your script:

files = {"include_files": ["<Location to Python>/Python36-32/DLLs/tcl86t.dll", "<Location to Python>/Python36-32/DLLs/tk86t.dll"], "packages": ["tkinter"]}

并使用:

options = {"build_exe": files},

它应该可以工作.

所以你的脚本应该看起来更像这样:

So your script should look more like this:

from cx_Freeze import setup, Executable
import os
import sys
import os.path

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')
files = {"include_files": ["<Location to Python>/Python36-32/DLLs/tcl86t.dll", "<Location to Python>/Python36-32/DLLs/tk86t.dll"], "packages": ["tkinter"]}

setup(
name = "Removed",
version = "3.5",
description = "Removed",
options = {"build_exe": files},
executables = [Executable(script = "test1.py", base = "Win32GUI")])

我希望这会有所帮助.

这篇关于不明错误.cx_freeze &amp;特金特的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆