py2exe 给出奇怪错误的 Hello world 示例

Hello world example for py2exe giving strange error

我有一个名为 "mini.py" 的文件,其中包含以下内容:

print("hello worlds")

如果我 运行 pip install py2exe --upgrade 我得到:

Requirement already up-to-date: py2exe in c:\python37\lib\site-packages (0.9.2.2)

如果我 运行 build_exe mini.py 我得到:

Traceback (most recent call last):
  File "c:\python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python37\Scripts\build_exe.exe\__main__.py", line 9, in <module>
  File "c:\python37\lib\site-packages\py2exe\build_exe.py", line 141, in main
    builder.analyze()
  File "c:\python37\lib\site-packages\py2exe\runtime.py", line 160, in analyze
    self.mf.import_hook(modname)
  File "c:\python37\lib\site-packages\py2exe\mf3.py", line 120, in import_hook
    module = self._gcd_import(name)
  File "c:\python37\lib\site-packages\py2exe\mf3.py", line 274, in _gcd_import
    return self._find_and_load(name)
  File "c:\python37\lib\site-packages\py2exe\mf3.py", line 357, in _find_and_load
    self._scan_code(module.__code__, module)
  File "c:\python37\lib\site-packages\py2exe\mf3.py", line 388, in _scan_code
    for what, args in self._scan_opcodes(code):
  File "c:\python37\lib\site-packages\py2exe\mf3.py", line 417, in _scan_opcodes
    yield "store", (names[oparg],)
IndexError: tuple index out of range

有人知道是什么原因造成的吗?

确实是 Python - IndexError: tuple index out of range when using py2exe

的副本

Py2exe 0.9.2.2 与 Python 兼容,最高可达 3.4,开发就此停止。

对于Python 3.7,GithUb 中有一个移植Py2Exe 的项目,工作正常。 https://github.com/albertosottile/py2exe