2017-02-10 1 views
1

J'ai un script appelé papercutter.py et un setup.py qui est mis en place comme suit selon le tutoriel py2exe:compilation script python à EXE avec py2exe, obtenir erreur

from distutils.core import setup 
import py2exe 

setup(console=['papercutter.py']) 

donc suivant le tutoriel , je lance python setup.py py2exe et il semble succès:

c:\Codes>python setup.py install 
running install 
running build 
running install_egg_info 
Removing C:\Python\Lib\site-packages\UNKNOWN-0.0.0-py3.6.egg-info 
Writing C:\Python\Lib\site-packages\UNKNOWN-0.0.0-py3.6.egg-info 

mais quand je lance l'étape suivante, python setup.py py2exe, je reçois l'erreur:

c:\Codes>python setup.py py2exe 
running py2exe 
Traceback (most recent call last): 
    File "setup.py", line 4, in <module> 
    setup(console=['papercutter.py']) 
    File "C:\Python\lib\distutils\core.py", line 148, in setup 
    dist.run_commands() 
    File "C:\Python\lib\distutils\dist.py", line 955, in run_commands 
    self.run_command(cmd) 
    File "C:\Python\lib\distutils\dist.py", line 974, in run_command 
    cmd_obj.run() 
    File "C:\Python\lib\site-packages\py2exe\distutils_buildexe.py", line 188,  in run 
    self._run() 
    File "C:\Python\lib\site-packages\py2exe\distutils_buildexe.py", line 267,  in _run 
    builder.analyze() 
    File "C:\Python\lib\site-packages\py2exe\runtime.py", line 157, in analyze 
    self.mf.import_package(modname[:-2]) 
    File "C:\Python\lib\site-packages\py2exe\mf3.py", line 91, in  import_package 
    self.import_hook(name) 
    File "C:\Python\lib\site-packages\py2exe\mf3.py", line 117, in import_hook 
    module = self._gcd_import(name) 
    File "C:\Python\lib\site-packages\py2exe\mf3.py", line 267, in _gcd_import 
    return self._find_and_load(name) 
    File "C:\Python\lib\site-packages\py2exe\mf3.py", line 320, in _ find_and_load 
    self._scan_code(module.__code__, module) 
    File "C:\Python\lib\site-packages\py2exe\mf3.py", line 352, in _scan_code 
    for what, args in self._scan_opcodes(code): 
    File "C:\Python\lib\site-packages\py2exe\mf3.py", line 381, in  _scan_opcodes 
    yield "store", (names[oparg],) 
IndexError: tuple index out of range 

Qu'est-ce que je fais mal ici?

Note: ceci est le tutoriel, je suivais: http://www.py2exe.org/index.cgi/Tutorial

Notez également: J'utilise py2exe 0.9.2.0 et python 3.6.0. Je pense que cela devrait aller bien ensemble.

Répondre

1

La réponse se trouve en bas de la trace. On dirait que vous avez un problème d'indexation avec un tuple. Les index sont basés sur 0 en Python.

+0

Cependant, je n'utilise pas de tableaux dans mon script. Je viens d'aller à un site Web et cliquez sur un certain nombre de choses –

+0

Avez-vous essayé cx_freeze, il supporte python 3.6. – IamBatman

+0

Les notes de publication de cx_freeze. http://cx-freeze.readthedocs.io/en/latest/releasenotes.html – IamBatman

1

Actuellement, py2exe prend en charge Python jusqu'à 3,4