0
exe文件,所以我想從一個小遊戲讓一個.exe文件,但是當我嘗試建立它,當我鍵入:轉換pygame的文件,cx_Freeze
setup.py build
它給人和錯誤pygame的不模塊
C:\Python33\Projects>setup.py build
running build
running build_exe
Traceback (most recent call last):
File "C:\Python33\Projects\setup.py", line 11, in <module>
executables = executables
File "C:\Python34\lib\site-packages\cx_Freeze\dist.py", line 362, in setup
distutils.core.setup(**attrs)
File "C:\Python34\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Python34\lib\distutils\command\build.py", line 126, in run
self.run_command(cmd_name)
File "C:\Python34\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Python34\lib\site-packages\cx_Freeze\dist.py", line 232, in run
freezer.Freeze()
File "C:\Python34\lib\site-packages\cx_Freeze\freezer.py", line 619, in Freeze
self.finder = self._GetModuleFinder()
File "C:\Python34\lib\site-packages\cx_Freeze\freezer.py", line 378, in _GetMo
duleFinder
finder.IncludePackage(name)
File "C:\Python34\lib\site-packages\cx_Freeze\finder.py", line 686, in Include
Package
module = self._ImportModule(name, deferredImports)
File "C:\Python34\lib\site-packages\cx_Freeze\finder.py", line 386, in _Import
Module
raise ImportError("No module named %r" % name)
ImportError: No module named 'pygame'
C:\Python33\Projects>
我的設置文件看起來像這樣:
import cx_Freeze
executables = [cx_Freeze.Executable("racegame.py")]
cx_Freeze.setup(
name="Racegame",
options={"build_exe": {"packages": ["pygame"],
"include_files": ["racecar.png"]}},
description="A race game",
executables = executables
)
我需要添加哪些腳本? – ViciousKangaroo
將這些代碼複製並粘貼到_setup.py_ –