Seite 1 von 1

Singel File .exe bundel .exe

Verfasst: Dienstag 1. August 2006, 17:10
von Burnser
Hi also ich bin hier seit Stunden am suchen aber ich finde nix darüber eine einzige einzllne .exe aus meinen python scripts zu machen.
The bundle option

By default py2exe creates these files in the dist directory which you must deploy:

1. One (or more) .exe files
2. The python##.dll
3. A couple of .pyd files which are the compiled extensions that the exe files need, plus any other .dll files that the extensions need.
4. A library.zip file which contains the compiled pure python modules as .pyc or .pyo files (if you have specified 'zipfile=None' in the setup script this file is append to the .exe files and not present in the dist-directory).

The --bundle <level> or -b <level> command line switch will create less files because binary extensions, runtime dlls, and even the Python-dll itself is bundled into the executable itself, or inside the library-archive if you prefer that.

The bundled pyds and dlls are never unpacked to the file system, instead they are transparently loaded at runtime from the bundle. The resulting executable appears to be statically linked.

Specifying a level of 2 includes the .pyd and .dll files into the zip-archive or the executable. Thus, the dist directory will contain your exe file(s), the library.zip file (if you haven't specified 'zipfile=None'), and the python dll. The advantage of this scheme is that the application can still load extension modules from the file system if you extend sys.path at runtime.

Using a level of 1 includes the .pyd and .dll files into the zip-archive or the executable itself, and does the same for pythonXY.dll. The advantage is that you only need to distribute one file per exe, which will however be quite large. Another advantage is that inproc COM servers will run completely isolated from other Python interpreters in the same exe. The disadvantage of this scheme is that it is impossible to load other extensions from the file system, the application will crash with a fatal Python error if you try this. I have still to find a way to prevent this and raise an ImportError instead - any suggestions how this can be implemented would be very welcome.

The bundle-option has been tested with some popular extensions, but of course there's no guarantee that any extension will work in bundled form - be sure to test the executable (which you should do anyway).

The bundle option achieves its magic by code which emulates the Windows LoadLibrary api, it is compiled into the exe-stubs that py2exe uses. For experimentation, it is also installed as a normal Python extension _memimporter.pyd in the lib\site-packages directory. The Python module zipextimported.py in the same directory demonstrates how it can be used to load binary extensions from zip-files.
Samples

The py2exe-installer installs some examples into the lib\site-packages\py2exe\samples directory, demonstrating several simple and advances features.

The singlefile subdirectory contains two samples which are built as single-file executables: a trivial wxPython gui program, and a pywin32 dll COM server module.
Das ist das einziggste was ich als sinnvoll halte, aber nicht so ganz verstehe.

also ich will nur eine einzige .exe datei das das selbe macht wie mein python script.

ne single file oder mit "bundle", aber ich hab das schon die ganze zeit versucht und bekomm es nicht hin.

kann jemand mal in ein paar sätzen erklären, wie man aus einem python script eine einzige .exe machen kann?


Wäre echt nett, Danke!



mfg

Verfasst: Dienstag 1. August 2006, 18:44
von Burnser
*push*

Hey das ist voll wichtig wie mach ich aus meinen Pthon script eine alleinstehende .exe?!

Ist wichtig!


Danke

mfg Burnser

Verfasst: Dienstag 1. August 2006, 19:39
von CrackPod
Schön, dass dir dein Thread wichtig is. Jedem anderem TO wird sein Thread auch wichtig sein...
Und nach <2 std brauchste nich pushen. Wie du vllt noch nicht bemerkt hast:
Hier sin nich 10.000 User aktiv. Da muss man eben mal warten.
Such doch derzeit einfach mal bei google, oder sonstwo.
Irgendwo wird schon was stehen. Eventuell auf engl.

Greetz

Verfasst: Dienstag 1. August 2006, 19:42
von Burnser
CrackPod hat geschrieben:Schön, dass dir dein Thread wichtig is. Jedem anderem TO wird sein Thread auch wichtig sein...
Und nach <2 std brauchste nich pushen. Wie du vllt noch nicht bemerkt hast:
Hier sin nich 10.000 User aktiv. Da muss man eben mal warten.
Such doch derzeit einfach mal bei google, oder sonstwo.
Irgendwo wird schon was stehen. Eventuell auf engl.

Greetz
Ich lese das forum neben bei auch noch ein bisschen...
Hier ist kaum was los also dürfte das jetzt nicht so schlimm gewesen sein.

Und ja ich suche die ganze zeit bei google etc auch wo ich den thread erstellt habe.


Naja ich hoffe mir kann jetzt wirklich mal jemand helfen.


mfg

Verfasst: Dienstag 1. August 2006, 20:53
von DatenMetzgerX
py2exe --bundle 1

sollte das für dich sein evtl. ;)

Verfasst: Mittwoch 2. August 2006, 12:41
von Burnser
funktioniert leider auchnicht :cry: :(

Verfasst: Mittwoch 2. August 2006, 13:23
von Masaru
Falls es sich bei deinen Programmen um Consolen-Scripten handelt, probier mal das hier in der py2exe-setup-datei:

Code: Alles auswählen

# ... hier natürlich der ganze reguläre Code davor (Imports, etc.) ...
setup(
    name = 'Your Application Name',
    description = 'I am not experiment joyful',
    version = '1.0.0',
    options = { 'py2exe' : { 'bundle_files' : 1,
                             'optimize' : 2,
                             'compressed' : 1,
                             },
               },
    zipfile = None, 
    console = [ { 'script': 'scrip_name.py', # WICHTIG: tausch's gegen deinen Scriptnamen aus ;)
                  'company_name' : 'NotExperimentJoyful',
                  'copyright' : 'NotExperimentJoyful',
                }
               ],
    )
Falls es sich um GUI-Anwendungen (oder Services) handelt ... ist es natürlich anzupassen (Py2Exe Wiki hilft manchmal auch ganz gut weiter)