簡體   English   中英

cx_Freeze“列表”對象沒有屬性“項目”

[英]cx_Freeze 'list' object has no attribute 'items'

我正在嘗試將pygame文件轉換為.exe,並且正在使用cx_Freeze做到這一點

但是,當我在控制台中輸入py setup.py build ,它將響應:

PS C:\Python34> py setup.py build
Traceback (most recent call last):

  File "setup.py", line 22, in <module>
    executables = [cx_Freeze.Executable("CattwalkV3C.py")]
  File "C:\Python34\lib\site-packages\cx_Freeze\dist.py", line 349, in setup
    distutils.core.setup(**attrs)
  File "C:\Python34\lib\distutils\core.py", line 108, in setup
    _setup_distribution = dist = klass(attrs)
  File "C:\Python34\lib\site-packages\cx_Freeze\dist.py", line 24, in __init__
    distutils.dist.Distribution.__init__(self, attrs)
  File "C:\Python34\lib\distutils\dist.py", line 236, in __init__
    for (opt, val) in cmd_options.items():
AttributeError: 'list' object has no attribute 'items' 

我還看到了與此問題有關的其他幾個問題,但它們都只是說某些項目被過度封裝。 這是我的代碼:

import cx_Freeze
from cx_Freeze import *

files = ["BLUE CALLISTO.png", "RED CALLISTO.png", "BLUE LUNA.png",
"RED LUNA.png", "BLUE DEIMOS.png", "RED DEIMOS.png"
"BLUE GANYMEDE.png", "RED GANYMEDE.png", "BLUE IO.png",
"RED IO.png", "BLUE EUROPA.png", "RED EUROPA.png",
"BLUE TITAN.png", "RED TITAN.png", "RED SOL.png",
"BLUE SOL.png", "CattwalkBoard.png", "STYX.png"
"blue turn.png", "red turn.png", "LongLine.png",
"ShortLine.png", "PlaceHolder.png"]

includeThese = ["pygame", "pickle", "os", "random", "time", "math", 
"socket"]

cx_Freeze.setup(
    name = "CattwalkV3C",
    options = {"build_exe":{"packages": includeThese},
                                    "include_files": files},

    executables = [cx_Freeze.Executable("CattwalkV3C.py")]
)

我相信您的格式有些混亂,請嘗試使用以下格式:

import cx_Freeze
from cx_Freeze import *

files = ["BLUE CALLISTO.png", "RED CALLISTO.png", "BLUE LUNA.png",
"RED LUNA.png", "BLUE DEIMOS.png", "RED DEIMOS.png"
"BLUE GANYMEDE.png", "RED GANYMEDE.png", "BLUE IO.png",
"RED IO.png", "BLUE EUROPA.png", "RED EUROPA.png",
"BLUE TITAN.png", "RED TITAN.png", "RED SOL.png",
"BLUE SOL.png", "CattwalkBoard.png", "STYX.png"
"blue turn.png", "red turn.png", "LongLine.png",
"ShortLine.png", "PlaceHolder.png"]
executables = [cx_Freeze.Executable("CattwalkV3C.py")]
includeThese = ["pygame", "pickle", "os", "random", "time", "math", 
"socket"]

cx_Freeze.setup(
    name = "CattwalkV3C",
    options = {"build_exe":{"packages": includeThese,
                            "include_files": includeThese 
                            },
               })

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM