【问题标题】:Writing out document in GUI executable using cx_freeze not working使用 cx_freeze 在 GUI 可执行文件中写出文档不起作用
【发布时间】:2018-08-13 08:16:51
【问题描述】:

我使用 cx_freeze 制作了一个可执行的 gui(带有 tkinter)文件。可执行文件有几个按钮。当用户点击按钮时,计算应该会工作,然后它会写出一个 xlsx 文件。

当我制作可执行文件时一切都很顺利,没有错误。但是当我单击按钮时,计算似乎有效(因为它正在加载),但它并没有写出 xlsx 文件。

我不知道出了什么问题。谁能帮帮我?

这里是 setup.py 文件:

import sys
from cx_Freeze import setup, Executable

import os
import tkinter

base = None

if sys.platform == 'win32':
    base = "Win32GUI"


executables = [Executable("gui.py", base=base)]

packages = ["tkinter", 'xlsxwriter', 'matplotlib']
options = {
    'build_exe': {
        'includes': ["os", "tkinter", 'numpy.core._methods', 'numpy.lib.format', 'xlrd', 'scipy', 'pandas'],
        'include_files': [r"C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\DLLs\tcl86t.dll",
                          r"C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\DLLs\tk86t.dll"]
    },

}

os.environ['TCL_LIBRARY'] = r'C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\tcl\tk8.6'


setup(
    name="Tool",
    version="1.0",
    description="Tool prototype for calculating",
    options=options,
    executables=executables
)

【问题讨论】:

    标签: user-interface executable cx-freeze xlsxwriter


    【解决方案1】:

    我已经解决了这个问题。

    我所做的是将 setup.py 中的基础更改为:base = None

    我按照这个帖子安装了 xlsxwriter:ImportError: No module named 'xlsxwriter': Error in bamboo

    在这之后,我又遇到了一个问题:

    没有名为:scipy.sparse.csgraph._validation 的模块

    但我只是将其添加到“包含”中:['scipy.sparse.csgraph._validation', ...]

    现在一切正常。

    希望对遇到同样问题的人有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-01
      • 1970-01-01
      相关资源
      最近更新 更多