[我正在运行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,这是我的仓库。
我正在运行macOS Catalina 10.15.2的Mac上为Python 3.8.3中的朋友构建一个tkinter GUI,并尝试使用cx_freeze 6.1将其冻结。当我在本地环境中运行python应用程序时...
您解决了吗?我有完全一样的问题。