2017-11-13 7 views
0

kompilieren Ich habe versucht, mein Programm mit py2exe mit dem setup.py und alles zu kompilieren, aber wenn ich versuche, die Konsole das gibt mir:Python 3.4: py2exe nicht Programm mit tkinter

Traceback (most recent call last): 
    File "setup.py", line 10, in <module> 
zipfile = None) 
    File "C:\Python34\lib\distutils\core.py", line 149, in setup 
dist.run_commands() 
    File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands 
self.run_command(cmd) 
    File "C:\Python34\lib\distutils\dist.py", line 974, in run_command 
cmd_obj.run() 
    File "C:\Python34\lib\site-packages\py2exe\distutils_buildexe.py", line 188, in run 
self._run() 
    File "C:\Python34\lib\site-packages\py2exe\distutils_buildexe.py", line 267, in _run 
builder.analyze() 
    File "C:\Python34\lib\site-packages\py2exe\runtime.py", line 164, in analyze 
mf.import_hook(modname) 
    File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 120, in import_hook 
    module = self._gcd_import(name) 
    File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 274, in _gcd_import 
    return self._find_and_load(name) 
    File "C:\Python34\lib\site-packages\py2exe\mf3.py", line 337, in 
_find_and_load 
    raise ImportError(name) 
ImportError: Tkinter 

Ich laufe dies über die Konsole python.exe setup.py py2exe

Die setup.py sieht ungefähr wie folgt:

von distutils.core Import Setup Import py2exe

setup(window=[{'script': 'filename.py'}], \ 
      options={"py2exe": {"includes": ["decimal", "Tkinter", \ 
      "tkFileDialog", "csv", "xml.dom.minidom", "os"], \ 
      'bundle_files': 3, 'compressed': False}}, \ 
      zipfile = None) 


excludes = ["pywin", "pywin.debugger", "pywin.debugger.dbgcon", 
      "pywin.dialogs", "pywin.dialogs.list", 
      "Tkconstants","Tkinter","tcl", "_imagingtk", "PIL._imagingtk", 
      "ImageTk", "PIL.ImageTk", "FixTk" 
       ] 

Bitte helfen Sie, ich weiß nicht, was ich tue.

Danke

Antwort

1

Sie kompilieren mit Python 3. In Python 3 ist das Paket tkinter, nicht Tkinter

+0

Vielen Dank! Aber jetzt gibt es mir: 'ImportError: tkFileDialog' also ähm was soll ich jetzt tun? –

+0

@ Egor.L: Was sollten Sie jetzt tun? Sie müssen ein bisschen mehr Forschung darüber, was mit Tkinter zwischen Python 2 und 3 geändert hat. –

+0

In Ordnung, vielen Dank! –

0

Ich habe nicht genug Ruf haben einen Kommentar hinzuzufügen, aber der tkFiledialog Fehler ist ähnlich an den Tkinter < -> tkinter Fehler. In Python 3 verwenden Sie import tkinter.filedialog im Gegensatz zu import tkFileDialog wie in Python 2.7

Verwandte Themen