我正在构建一个tkinter
一位朋友在运行 macOS Catalina 10.15.2 的 Mac 上使用 Python 3.8.3 的 GUI,并尝试使用冻结它cx_freeze
6.1.
当我在本地环境中运行 python 应用程序时,该应用程序运行良好。 (截屏:本地环境中的 tkinter GUI https://i.stack.imgur.com/HTPjQ.png)
当我使用 cx_freeze 打包应用程序并尝试运行 Linux 可执行文件时,tkinter 窗口打开,但它是全黑的,我看不到其中的任何内容(屏幕截图:使用 cx_freeze 打包后的 tkinter GUI https://i.stack.imgur.com/CuwAB.png)
My 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 https://github.com/gazelle51/nr-solver.