1
我已經很長一段時間了這個錯誤,我試過重新安裝等。在我嘗試從Pygame程序中創建可執行文件之前,cx_Freeze一直工作正常。這裏的錯誤:cx_Freeze文件錯誤
File "setup.py", line 8, in <module>
executables=executables
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\dist.py", line 349, in setup
distutils.core.setup(**attrs)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\distutils\command\build.py", line 135, in run
self.run_command(cmd_name)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\dist.py", line 219, in run
freezer.Freeze()
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\freezer.py", line 621, in Freeze
self.finder = self._GetModuleFinder()
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\freezer.py", line 340, in _GetModuleFinder
finder.IncludePackage(name)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 655, in IncludePackage
self._ImportAllSubModules(module, deferredImports)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 279, in _ImportAllSubModules
deferredImports)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 403, in _InternalImportModule
parentModule, namespace)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 416, in _LoadModule
namespace)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 485, in _LoadPackage
self._LoadModule(name, fp, path, info, deferredImports, parent)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 474, in _LoadModule
self._ScanCode(module.code, module, deferredImports)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 564, in _ScanCode
module, relativeImportIndex)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 310, in _ImportModule
deferredImports, namespace = namespace)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 403, in _InternalImportModule
parentModule, namespace)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 474, in _LoadModule
self._ScanCode(module.code, module, deferredImports)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 564, in _ScanCode
module, relativeImportIndex)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 310, in _ImportModule
deferredImports, namespace = namespace)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 403, in _InternalImportModule
parentModule, namespace)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 416, in _LoadModule
namespace)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 485, in _LoadPackage
self._LoadModule(name, fp, path, info, deferredImports, parent)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 474, in _LoadModule
self._ScanCode(module.code, module, deferredImports)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 564, in _ScanCode
module, relativeImportIndex)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 310, in _ImportModule
deferredImports, namespace = namespace)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 403, in _InternalImportModule
parentModule, namespace)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 474, in _LoadModule
self._ScanCode(module.code, module, deferredImports)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 569, in _ScanCode
fromList, deferredImports)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 210, in _EnsureFromList
self._ImportModule(subModuleName, deferredImports, caller)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 310, in _ImportModule
deferredImports, namespace = namespace)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 403, in _InternalImportModule
parentModule, namespace)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 416, in _LoadModule
namespace)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 485, in _LoadPackage
self._LoadModule(name, fp, path, info, deferredImports, parent)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 474, in _LoadModule
self._ScanCode(module.code, module, deferredImports)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 588, in _ScanCode
topLevel = False)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 564, in _ScanCode
module, relativeImportIndex)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 310, in _ImportModule
deferredImports, namespace = namespace)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 403, in _InternalImportModule
parentModule, namespace)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 416, in _LoadModule
namespace)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 485, in _LoadPackage
self._LoadModule(name, fp, path, info, deferredImports, parent)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 463, in _LoadModule
self._RunHook("load", module.name, module)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\finder.py", line 536, in _RunHook
method(self, *args)
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cx_Freeze\hooks.py", line 613, in load_tkinter
tclSourceDir = os.environ["TCL_LIBRARY"]
File "C:\Users\alpac\AppData\Local\Programs\Python\Python36-32\lib\os.py", line 669, in __getitem__
raise KeyError(key) from None
KeyError: 'TCL_LIBRARY'
這裏的設置:
import cx_Freeze
executables = [cx_Freeze.Executable("game.py")]
cx_Freeze.setup(
name="Skillful Sky",
options={"build_exe": {"packages": ["pygame"], "include_files": ["gameairplane.png", "gameicon.png", "gamesong.wav"]}},
executables=executables
)
你能包含python文件的代碼嗎? –