【问题标题】:cx freeze : AttributeError: 'list' object has no attribute 'items'cx freeze : AttributeError: 'list' object has no attribute 'items'
【发布时间】:2021-11-02 00:32:05
【问题描述】:
import sys, os
from cx_Freeze import setup, Executable

# Dependencies are automatically detected, but it might need fine tuning.
# "packages": ["os"] is used as example only
build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]}


# base="Win32GUI" should be used only for Windows GUI app
base = None
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
include_files = [(os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'), os.path.join('lib', 'tk86t.dll')), (os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'), os.path.join('lib', 'tcl86t.dll'))]
if sys.platform == "win32":
    base = "Win32GUI"

setup(
    name = "Snake",
    version = "0.1",
    description = "A Classic Snake Game with a few Modifications!",
    options = {"build_exe": include_files},
    executables = [Executable("main.py", base=base)]

这就是我正在使用 cx freeze 的 setup.py 代码。尽管当我尝试使用 python setup.py build 运行它时,出现了这篇文章标题中的错误。告诉我是否需要提供更多信息并提前感谢您!

【问题讨论】:

    标签: python list cx-freeze


    【解决方案1】:

    build_exe 参数应该是参数/值集的字典。您需要检查文档。

    https://cx-freeze.readthedocs.io/en/latest/setup_script.html

    我怀疑你是故意的:

    ...
        options = {"build_exe": {"include_files": include_files}},
    

    【讨论】:

      猜你喜欢
      • 2022-01-10
      • 2020-06-17
      • 1970-01-01
      • 1970-01-01
      • 2022-12-01
      • 2013-09-11
      • 2017-10-21
      • 2014-07-13
      • 1970-01-01
      相关资源
      最近更新 更多