Ich habe ein Python-Skript mit Tkinter erstellt und versuche es mit einem Mac mit Pyinstaller zu packen. Pyinstaller erstellt die ausführbare Datei, aber wenn ich versuche, sie auszuführen, sagt das Tkinter-Modul fehlt. Ich weiß, dass es auf SO mehrere ähnliche Fragen gibt, aber keine der Lösungen hat für mich funktioniert. HierPyinstaller Kein Modul Tkinter
ist die Spitze meiner main.py
Skript:
#!/usr/bin/env python
import sys
import os
import traceback
import json
import time
import Tkinter
Hier meine pyinstaller Version ist:
$ pyinstaller --version
3.3.dev0+483c819
Ich betreibe pyinstaller mit diesem Befehl:
$ pyinstaller main.py
Hier ist die Ausgabe dieses Befehls:
30 INFO: PyInstaller: 3.3.dev0+483c819
30 INFO: Python: 3.4.3
34 INFO: Platform: Darwin-15.6.0-x86_64-i386-64bit
35 INFO: wrote /Users/jonathanwilson/Documents/Projects/hr_digitization_tool/hr-records-management-tool-no-container/main.spec
36 INFO: UPX is not available.
38 INFO: Extending PYTHONPATH with paths
['/Users/jonathanwilson/Documents/Projects/hr_digitization_tool/hr-records-management-tool-no-container',
'/Users/jonathanwilson/Documents/Projects/hr_digitization_tool/hr-records-management-tool-no-container']
38 INFO: checking Analysis
38 INFO: Building Analysis because out00-Analysis.toc is non existent
38 INFO: Initializing module dependency graph...
39 INFO: Initializing module graph hooks...
40 INFO: Analyzing base_library.zip ...
1395 INFO: Processing pre-find module path hook distutils
2445 INFO: running Analysis out00-Analysis.toc
2452 INFO: Caching module hooks...
2454 INFO: Analyzing /Users/jonathanwilson/Documents/Projects/hr_digitization_tool/hr-records-management-tool-no-container/main.py
2499 INFO: Loading module hooks...
2499 INFO: Loading module hook "hook-encodings.py"...
2553 INFO: Loading module hook "hook-pydoc.py"...
2553 INFO: Loading module hook "hook-xml.py"...
2753 INFO: Loading module hook "hook-distutils.py"...
2766 INFO: Looking for ctypes DLLs
2766 INFO: Analyzing run-time hooks ...
2773 INFO: Looking for dynamic libraries
2836 INFO: Looking for eggs
2836 INFO: Using Python library /Library/Frameworks/Python.framework/Versions/3.4/Python
2838 INFO: Warnings written to /Users/jonathanwilson/Documents/Projects/hr_digitization_tool/hr-records-management-tool-no-container/build/main/warnmain.txt
2861 INFO: checking PYZ
2861 INFO: Building PYZ because out00-PYZ.toc is non existent
2861 INFO: Building PYZ (ZlibArchive) /Users/jonathanwilson/Documents/Projects/hr_digitization_tool/hr-records-management-tool-no-container/build/main/out00-PYZ.pyz
3175 INFO: checking PKG
3176 INFO: Building PKG because out00-PKG.toc is non existent
3176 INFO: Building PKG (CArchive) out00-PKG.pkg
3185 INFO: Bootloader /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/PyInstaller/bootloader/Darwin-64bit/run
3185 INFO: checking EXE
3185 INFO: Building EXE because out00-EXE.toc is non existent
3185 INFO: Building EXE from out00-EXE.toc
3185 INFO: Appending archive to EXE /Users/jonathanwilson/Documents/Projects/hr_digitization_tool/hr-records-management-tool-no-container/build/main/main
3187 INFO: Fixing EXE for code signing /Users/jonathanwilson/Documents/Projects/hr_digitization_tool/hr-records-management-tool-no-container/build/main/main
3192 INFO: checking COLLECT
3192 INFO: Building COLLECT because out00-COLLECT.toc is non existent
3192 INFO: Building COLLECT out00-COLLECT.toc
Wenn ich ausführen, um die ausführbare Datei ein Terminalfenster mit der folgenden Ausgabe öffnet:
Last login: Tue Jan 3 11:35:51 on ttys004
/Users/jonathanwilson/Documents/Projects/hr_digitization_tool/hr-records-management-tool-no-container/dist/main/main ; exit;
[11:43:24][~]$ /Users/jonathanwilson/Documents/Projects/hr_digitization_tool/hr-records-management-tool-no-container/dist/main/main ; exit;
Traceback (most recent call last):
File "main.py", line 7, in <module>
ImportError: No module named 'Tkinter'
Failed to execute script main
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
[Process completed]
ich versucht habe, mit --hidden-import Tkinter
den pyinstaller Befehl ausgeführt wird, aber das immer noch nicht funktioniert. Ich habe den pydinstaller docs Abschnitt "Wenn Dinge falsch laufen" überprüft, sehe aber immer noch keine Lösung.
in Python3 wurde Tkinter in Tkinter umbenannt. –
@BryanOakley aber diese Frage ist markiert mit 'Python-2.7'. Sie müssen auch das Python-Modul installieren, was über Pip erfolgen kann. Führen Sie 'pip install tkinter' in der Befehlszeile aus. –
yeah, aber es sieht aus wie pyinstaller python 3: '30 INFO: Python: 3.4.3' Und ich glaube nicht, dass Sie tkinter mit pip installieren können. –