ich möchte meine Skripte in möglichst wenige Binärdateien packen - am besten nur eine Datei und hab mich dafür ein wenig umgeschaut dabei bin ich bei PyInstaller hängen geblieben:
Py2exe - Windows only
cx_freeze - Funktioniert einfach und gut, aber python selber lässt sich nicht "einpacken" und es werden immer mehrere Dateien
PyInstaller - Unix/Windows, single file möglich, komplettes packen von Python möglich (Keine weiteren Abhängigkeiten)
Nun hab ich gleich nach dem Manual PyInstaller 1.2 (latest stable) installiert und mit "python Makespec.py script.py" eine spec-Datei erstellt (Ich hab erstmal auf das --onefile Feature verzichtet da man bei diesem laut des Manuals mehr beachten muss) und mithilfe von dieser dann das Script mit Abhängigkeiten "kompiliert" (python Build.py specpath/script.spec). Dies schien auch problemlos durchzulaufen und die Binäre Datei wurde auch erstellt zusammen mit den Modulen als .so's
Das Script nutzt pyGTK und hat somit das gleichnamige Modul importiert und ebenfalls den Glade-Support.
gtk, pygtk usw scheint auch als .so Dateien im erstellten Verzeichnis vorzuliegen aber beim starten des Script kommt der Fehler:
Code: Alles auswählen
Traceback (most recent call last):
File "<string>", line 6, in ?
File "/pathto/pyinstaller_1.2/iu.py", line 312, in importHook
File "pathto/pyinstaller_1.2/iu.py", line 398, in doimport
File "scriptname/buildscriptname/out1.pyz/gtk", line 48, in ?
ImportError: cannot import name _gtk
PS: In der warn****.txt welche beim Build erstellt wurde ist folgendes zu finden:
Code: Alles auswählen
W: no module named gdk (top-level import by gtk)
W: no module named msvcrt (conditional import by subprocess)
W: no module named ltihooks (top-level import by gtk)
W: no module named ltihooks (top-level import by gobject)
W: no module named _subprocess (conditional import by subprocess)
W: no module named org (top-level import by pickle)
W: no module named org (top-level import by copy)
W: no module named _emx_link (conditional import by os)
W: no module named Carbon (conditional import by tempfile)
W: __all__ is built strangely at line 0 - __future__ (/usr/lib/python2.4/__future__.pyc)
W: delayed exec statement detected at line 0 - pdb (/usr/lib/python2.4/pdb.pyc)
W: delayed conditional eval hack detected at line 0 - pdb (/usr/lib/python2.4/pdb.pyc)
W: delayed eval hack detected at line 0 - pdb (/usr/lib/python2.4/pdb.pyc)
W: delayed conditional eval hack detected at line 0 - pdb (/usr/lib/python2.4/pdb.pyc)
W: delayed eval hack detected at line 0 - pdb (/usr/lib/python2.4/pdb.pyc)
W: delayed __import__ hack detected at line 0 - gtk._lazyutils (/var/lib/python-support/python2.4/gtk-2.0/gtk/_lazyutils.pyc)
W: delayed conditional __import__ hack detected at line 0 - gtk._lazyutils (/var/lib/python-support/python2.4/gtk-2.0/gtk/_lazyutils.pyc)
W: __all__ is built strangely at line 0 - dis (/usr/lib/python2.4/dis.pyc)
W: delayed __import__ hack detected at line 0 - encodings (/usr/lib/python2.4/encodings/__init__.pyc)
W: delayed conditional __import__ hack detected at line 0 - gtk.deprecation (/var/lib/python-support/python2.4/gtk-2.0/gtk/deprecation.pyc)
W: __all__ is built strangely at line 0 - re (/usr/lib/python2.4/re.pyc)
W: delayed conditional __import__ hack detected at line 0 - doctest (/usr/lib/python2.4/doctest.pyc)
W: delayed exec statement detected at line 0 - doctest (/usr/lib/python2.4/doctest.pyc)
W: delayed eval hack detected at line 0 - os (/usr/lib/python2.4/os.pyc)
W: delayed conditional __import__ hack detected at line 0 - unittest (/usr/lib/python2.4/unittest.pyc)
W: delayed conditional __import__ hack detected at line 0 - unittest (/usr/lib/python2.4/unittest.pyc)
W: __all__ is built strangely at line 0 - tokenize (/usr/lib/python2.4/tokenize.pyc)
W: delayed conditional exec statement detected at line 0 - iu (/pathto/pyinstaller_1.2/iu.pyc)
W: delayed conditional exec statement detected at line 0 - iu (/pathto/pyinstaller_1.2/iu.pyc)
W: delayed exec statement detected at line 0 - bdb (/usr/lib/python2.4/bdb.pyc)
W: delayed eval hack detected at line 0 - bdb (/usr/lib/python2.4/bdb.pyc)
W: delayed eval hack detected at line 0 - bdb (/usr/lib/python2.4/bdb.pyc)
W: delayed __import__ hack detected at line 0 - pickle (/usr/lib/python2.4/pickle.pyc)
W: delayed __import__ hack detected at line 0 - pickle (/usr/lib/python2.4/pickle.pyc)
W: delayed conditional eval hack detected at line 0 - warnings (/usr/lib/python2.4/warnings.pyc)
W: delayed conditional __import__ hack detected at line 0 - warnings (/usr/lib/python2.4/warnings.pyc)
foxx