我在一个简单的脚本上尝试 py2exe;如果我是正确的,我必须在控制台中使用以开始构建 .exe 文件的命令是
build_exe myscript.py
但是当我这样做时,我得到了这个错误:
Traceback (most recent call last):
File "c:\program files (x86)\python37-32\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\program files (x86)\python37-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Program Files (x86)\Python37-32\Scripts\build_exe.exe\__main__.py", line 9, in <module>
File "c:\program files (x86)\python37-32\lib\site-packages\py2exe\build_exe.py", line 141, in main
builder.analyze()
File "c:\program files (x86)\python37-32\lib\site-packages\py2exe\runtime.py", line 160, in analyze
self.mf.import_hook(modname)
File "c:\program files (x86)\python37-32\lib\site-packages\py2exe\mf3.py", line 120, in import_hook
module = self._gcd_import(name)
File "c:\program files (x86)\python37-32\lib\site-packages\py2exe\mf3.py", line 274, in _gcd_import
return self._find_and_load(name)
File "c:\program files (x86)\python37-32\lib\site-packages\py2exe\mf3.py", line 357, in _find_and_load
self._scan_code(module.__code__, module)
File "c:\program files (x86)\python37-32\lib\site-packages\py2exe\mf3.py", line 388, in _scan_code
for what, args in self._scan_opcodes(code):
File "c:\program files (x86)\python37-32\lib\site-packages\py2exe\mf3.py", line 417, in _scan_opcodes
yield "store", (names[oparg],)
IndexError: tuple index out of range
我做错了什么?谢谢!
请您参考如下方法:
Py2exe 支持的最后一个 Python 版本是 Python 3.4,也许是 3.5。在 Python 3.6 中,CPython 发生了一些变化,这使得当前的 py2exe 变得无用。 Py2exe已经很多年没有更新了,可以说是abandonware。
你在this SO post.中有更详细的讨论
