cx freeze : AttributeError: 'list' object has no attribute 'items'
Posted
技术标签:
【中文标题】cx freeze : AttributeError: \'list\' object has no attribute \'items\'【英文标题】: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 运行它时,出现了这篇文章标题中的错误。告诉我是否需要提供更多信息并提前感谢您!
【问题讨论】:
【参考方案1】:build_exe
参数应该是参数/值集的字典。您需要检查文档。
https://cx-freeze.readthedocs.io/en/latest/setup_script.html
我怀疑你是故意的:
...
options = "build_exe": "include_files": include_files,
【讨论】:
以上是关于cx freeze : AttributeError: 'list' object has no attribute 'items'的主要内容,如果未能解决你的问题,请参考以下文章
cx_Freeze:主脚本中的 Python 错误。 Python 3.6 + cx_Freeze
cx_freeze 错误“cx_Freeze.freezer.ConfigError:没有名为控制台的基础”