cx_freeze 创建 EXE 时没有基于命名的“Win32GUI”错误
Posted
技术标签:
【中文标题】cx_freeze 创建 EXE 时没有基于命名的“Win32GUI”错误【英文标题】:cx_freeze no based named 'Win32GUI' error when creating a EXE 【发布时间】:2021-10-12 12:50:42 【问题描述】:我想将应用程序转换为可执行文件并为此目的使用 cx_freeze。 但我收到了这个错误消息:
......executable.py, line 86, in base
raise ConfigError(f"no base named name!r")
cx_Freeze.exception.ConfigError: no base named 'Win32GUI'
版本:Win 10 Home (x64);蟒蛇3.9.6; Cx_Freeze 6.8; PyQt - 5.15.4;
这很奇怪,因为前段时间这段代码没有问题?!
import sys
from cx_Freeze import setup, Executable
try:
from cx_Freeze.hooks import get_qt_plugins_paths
except ImportError:
include_files = []
else:
# Inclusion of extra plugins (new in cx_Freeze 6.8b2)
# cx_Freeze imports automatically the following plugins depending of the
# use of some modules:
# imageformats - QtGui
# platforms - QtGui
# mediaservice - QtMultimedia
# printsupport - QtPrintSupport
#
# So, "platforms" is used here for demonstration purposes.
include_files = get_qt_plugins_paths("PyQt5", "platforms")
# base="Win32GUI" should be used only for Windows GUI app
base = None
if sys.platform == "win32":
base = "Win32GUI"
build_exe_options =
"excludes": [""],
"include_files": include_files,
bdist_mac_options =
"bundle_name": "Test",
bdist_dmg_options =
"volume_label": "TEST",
executables = [Executable("main.py", base=base, target_name="TESTS")]
setup(
name="simple_PyQt5",
version="0.3",
description="Sample cx_Freeze PyQt5 script",
options=
"build_exe": build_exe_options,
"bdist_mac": bdist_mac_options,
"bdist_dmg": bdist_dmg_options,
,
executables=executables,
)
【问题讨论】:
【参考方案1】:找到了解决方案。 更新了所有要求(pip's),然后它就起作用了。不知道为什么会这样,但是没关系
【讨论】:
以上是关于cx_freeze 创建 EXE 时没有基于命名的“Win32GUI”错误的主要内容,如果未能解决你的问题,请参考以下文章
使用 cx_Freeze 创建 exe 或 msi 时使用 Tkinter tix 的 Python 错误
使用 cx_freeze 为 tkinter 接口创建 .exe 文件
使用 cx_Freeze 创建一个带有 Python 3.4 的 exe