【问题标题】:cx_freeze no based named 'Win32GUI' error when creating a EXEcx_freeze 创建 EXE 时没有基于命名的“Win32GUI”错误
【发布时间】: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,
)

【问题讨论】:

    标签: python cx-freeze


    【解决方案1】:

    找到了解决方案。 更新了所有要求(pip's),然后它就起作用了。不知道为什么会这样,但是没关系

    【讨论】:

      猜你喜欢
      • 2019-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-25
      相关资源
      最近更新 更多