【问题标题】:cx Freeze executable no starting import _tkinter # if this fails your python may not be configured for tkcx Freeze executable no starting import _tkinter # 如果失败,你的 python 可能没有配置为 tk
【发布时间】:2017-02-14 14:41:07
【问题描述】:

我是 Python 新手。我正在尝试使用 cx_freeze 创建可执行文件,但创建文件后无法启动 exe。我收到以下错误:

我正在使用 pytone 3.6.0

代码

import sys
import os
os.environ['TCL_LIBRARY'] = "C:\\Users\\Valeri\\AppData\\Local\\Programs\\Python\\Python36-32\\tcl\\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\\Users\\Valeri\\AppData\\Local\\Programs\\Python\\Python36-32\\tcl\\tk8.6"
from cx_Freeze import setup, Executable
# replaces commandline arg 'build'
sys.argv.append("build")  
# change the filename to your program file --->
filename = "SolutionGenerator.py"
base = None
if sys.platform == "win32":
    base = "Win32GUI"
setup(
    name = "Circle",
    version = "1.0",
    description = "cx_Freeze Tkinter script",
    executables = [Executable(filename, base=base)])

setup.py

import sys import os os.environ['TCL_LIBRARY'] = "C:\\Users\\Valeri\\AppData\\Local\\Programs\\Python\\Python36-32\\tcl\\tcl8.6" os.environ['TK_LIBRARY'] = "C:\\Users\\Valeri\\AppData\\Local\\Programs\\Python\\Python36-32\\tcl\\tk8.6" from cx_Freeze import setup, Executable "SolutionGenerator.py" base = None if sys.platform == "win32":
    base = "Win32GUI" setup(
    name = "Circle",
    version = "1.0",
    description = "cx_Freeze Tkinter script",
    executables = [Executable(filename, base=base)])

我尝试了我在互联网上找到的所有内容,但无法让这个 exe 工作。 在 Python 3.6 中是否有其他可能从 py 创建 exe?

【问题讨论】:

标签: executable cx-freeze


【解决方案1】:

我遇到了完全相同的问题,并通过在 exe 目录中手动复制以下 dll 来解决它:

  • %PYTHON%\DLLs\tcl86t.dll
  • %PYTHON%\DLLs\tk86t.dll

【讨论】:

    猜你喜欢
    • 2017-09-20
    • 2020-12-17
    • 2020-09-04
    • 2011-07-24
    • 1970-01-01
    • 2011-09-13
    • 2017-06-03
    • 2014-04-28
    • 1970-01-01
    相关资源
    最近更新 更多