[英]cx_Freeze File errors
我已經很長一段時間以來一直收到此錯誤,我嘗試重新安裝等等。 在嘗試使用Pygame程序制作可執行文件之前,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
)
我認為這已經得到解答-https: //stackoverflow.com/a/35706103/7046074 。 請在發布之前做一些研究,如果您嘗試過,請提及它,以便人們能夠清楚地了解您的問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.