当使用py2ex时,python3.7返回“IndexError:tuple index out of range”

2024-09-29 19:31:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我困在我的Python学习中。在

文件

# calline function

import time
import webbrowser

#defining break_count

total_break = 4
break_count = 0

print ("The program started on " + time.ctime())

# loop

while (break_count<total_break):
    time.sleep(3)
    webbrowser.open ("https://www.youtube.com/watch?v=76fPNMREfHM")
    break_count = break_count + 1

input ("Press Enter to exit")

设置.py代码

^{pr2}$

在运行代码python时设置.pypy2exe我得到索引错误

命令错误

    D:\Python>python setup.py py2exe
running py2exe
Traceback (most recent call last):
  File "setup.py", line 4, in <module>
    setup(console=["helo.py"])
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\distutils\
core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\distutils\
dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\distutils\
dist.py", line 985, in run_command
    cmd_obj.run()
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\py2exe\distutils_buildexe.py", line 188, in run
    self._run()
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\py2exe\distutils_buildexe.py", line 267, in _run
    builder.analyze()
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\py2exe\runtime.py", line 160, in analyze
    self.mf.import_hook(modname)
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\py2exe\mf3.py", line 120, in import_hook
    module = self._gcd_import(name)
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\py2exe\mf3.py", line 274, in _gcd_import
    return self._find_and_load(name)
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\py2exe\mf3.py", line 357, in _find_and_load
    self._scan_code(module.__code__, module)
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\py2exe\mf3.py", line 388, in _scan_code
    for what, args in self._scan_opcodes(code):
  File "C:\Users\Minhaj\AppData\Local\Programs\Python\Python37-32\lib\site-packa
ges\py2exe\mf3.py", line 417, in _scan_opcodes
    yield "store", (names[oparg],)
IndexError: tuple index out of range

我该怎么纠正呢?在

我有python3.7。我更新了pip。我检查了Python目录中安装的py2exe。在


Tags: runinpyliblocallinesiteusers

热门问题