是什么导致IndexError:py2exe中的元组索引超出范围

问题描述

我刚刚安装了Python 3.8.5和py2exe 0.9.2.2。我有一个setup.py,可以在python 2.7上与py2exe 0.6.9一起使用。当我跑步时 setup.py py2exe(实际的命令行是 py setupexe.py py2exe) 我得到的新版本是:

    Traceback (most recent call last):
      File "setupexe.py",line 4,in <module>
        setup(name='md2html',File "C:\Program Files\python38\lib\distutils\core.py",line 148,in setup
        dist.run_commands()
      File "C:\Program Files\python38\lib\distutils\dist.py",line 966,in run_commands
        self.run_command(cmd)
      File "C:\Program Files\python38\lib\distutils\dist.py",line 985,in run_command
        cmd_obj.run()
      File "C:\Users\Gary\AppData\Roaming\Python\python38\site-packages\py2exe\distutils_buildexe.py",line 188,in run
        self._run()
      File "C:\Users\Gary\AppData\Roaming\Python\python38\site-packages\py2exe\distutils_buildexe.py",line 267,in _run
        builder.analyze()
      File "C:\Users\Gary\AppData\Roaming\Python\python38\site-packages\py2exe\runtime.py",line 160,in analyze
        self.mf.import_hook(modname)
      File "C:\Users\Gary\AppData\Roaming\Python\python38\site-packages\py2exe\mf3.py",line 120,in import_hook
        module = self._gcd_import(name)
      File "C:\Users\Gary\AppData\Roaming\Python\python38\site-packages\py2exe\mf3.py",line 274,in _gcd_import
        return self._find_and_load(name)
      File "C:\Users\Gary\AppData\Roaming\Python\python38\site-packages\py2exe\mf3.py",line 357,in _find_and_load
        self._scan_code(module.__code__,module)
      File "C:\Users\Gary\AppData\Roaming\Python\python38\site-packages\py2exe\mf3.py",line 388,in _scan_code
        for what,args in self._scan_opcodes(code):
      File "C:\Users\Gary\AppData\Roaming\Python\python38\site-packages\py2exe\mf3.py",line 417,in _scan_opcodes
        yield "store",(names[oparg],)
    IndexError: tuple index out of range

setup.py:

from distutils.core import setup
import py2exe
from md2html import __VERSION__
setup(name='md2html',version=__VERSION__,author='xxxxx',author_email='xxxxx',description='Convert Markdown to HTML',requires=['markdown(>=2.6.6)'],console=['md2html.py'],options={"py2exe":{
          "excludes": [
              'pyreadline','difflib','doctest','optparse','pickle','calendar','email','ftplib','httplib','rfc822','socket','select','ssl','_ssl']  # Exclude standard library
               }}
)

正如我所说,这以前奏效。我的下一步是在pdb中运行它,但是在我跳入陌生的代码之前,我想我会问。在Windows 10上运行。 谢谢。 更新:This question产生类似的错误。答案是py2exe不适用于Python 3.4之后的版本。令人失望!建议pyinstaller,我将对其进行调查。我真的希望有一种使py2exe工作的方法

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)