我正在运行macOS Catalina 10.15.2的Mac上使用Python 3.8.3为朋友构建tkinter
GUI,并尝试使用cx_freeze
6.1冻结它。
当我在本地环境中运行python应用程序时,该应用程序可以正常运行。 (屏幕截图:tkinter GUI in local environment)
当我使用cx_freeze打包应用程序并尝试运行Linux可执行文件时,tkinter窗口将打开,但它全是黑色的,我看不到其中的任何内容(屏幕截图:tkinter GUI after packaging with cx_freeze)
我的setup.py
文件在下面,我使用命令python3 setup.py build
运行它。文件中是否缺少某些内容?还是有人知道这是否是错误?我尝试直接在终端中运行可执行文件,没有错误。谢谢!
from cx_Freeze import setup, Executable
import os.path
import sys
# Dependencies are automatically detected, but it might need
# fine tuning.
buildOptions = dict(
packages=["numpy", "os", "sympy", "sys", "tkinter"],
includes=[],
excludes=[],
include_files=[],
# replace_paths=[("*", "")],
path=sys.path + ["lib"],
)
base = "Win32GUI" if sys.platform == "win32" else None
executables = [Executable("main.py", base=base)]
setup(
name="NR Method Solver",
version="1.0",
description="A calculator to solves equation(s) with one or two unknown variables.",
options=dict(build_exe=buildOptions),
executables=executables,
)
这是我的仓库,如果有人想查看整个代码库https://github.com/gazelle51/nr-solver。