How to create a single executable of a Python program

Discussion in 'Python' started by NicolasG, Jul 25, 2007.

  1. NicolasG

    NicolasG Guest

    Dear fellows,

    I'm trying to create a executable file using py2exe . Unfortunately
    along with the python executable file it also creates some other files
    that are needed in order to the executable be able to run in a system
    that doesn't have Python installed. Can some one guide me on how can I
    merge all this files created by py2exe in a single exe file ? If I
    have a python program that uses an image file I don't want this image
    file to be exposed in the folder but only to be accessible through the
    program flow..

    Regards,
    Nicolas.
     
    NicolasG, Jul 25, 2007
    #1
    1. Advertising

  2. NicolasG

    hong2221 Guest

    On Jul 25, 2:34 am, NicolasG <> wrote:
    > Dear fellows,
    >
    > I'm trying to create a executable file using py2exe . Unfortunately
    > along with the python executable file it also creates some other files
    > that are needed in order to the executable be able to run in a system
    > that doesn't have Python installed. Can some one guide me on how can I
    > merge all this files created by py2exe in a single exe file ? If I
    > have a python program that uses an image file I don't want this image
    > file to be exposed in the folder but only to be accessible through the
    > program flow..
    >
    > Regards,
    > Nicolas.


    I would like to konw as well. Thanks.
     
    hong2221, Jul 25, 2007
    #2
    1. Advertising

  3. NicolasG

    Guest

    On Jul 25, 9:10 am, hong2221 <> wrote:
    > On Jul 25, 2:34 am, NicolasG <> wrote:
    >
    > > Dear fellows,

    >
    > > I'm trying to create a executable file using py2exe . Unfortunately
    > > along with the python executable file it also creates some other files
    > > that are needed in order to the executable be able to run in a system
    > > that doesn't have Python installed. Can some one guide me on how can I
    > > merge all this files created by py2exe in a single exe file ? If I
    > > have a python program that uses an image file I don't want this image
    > > file to be exposed in the folder but only to be accessible through the
    > > program flow..

    >
    > > Regards,
    > > Nicolas.

    >
    > I would like to konw as well. Thanks.


    Check PyInstaller (http://pyinstaller.python-hosting.com)
     
    , Jul 25, 2007
    #3
  4. NicolasG

    Graeme Glass Guest

    On Jul 25, 8:34 am, NicolasG <> wrote:
    > Dear fellows,
    >
    > I'm trying to create a executable file using py2exe . Unfortunately
    > along with the python executable file it also creates some other files
    > that are needed in order to the executable be able to run in a system
    > that doesn't have Python installed. Can some one guide me on how can I
    > merge all this files created by py2exe in a single exe file ? If I
    > have a python program that uses an image file I don't want this image
    > file to be exposed in the folder but only to be accessible through the
    > program flow..
    >
    > Regards,
    > Nicolas.


    Have you taken a look at cx_Freeze? (http://python.net/crew/atuining/
    cx_Freeze/)
    http://www.velocityreviews.com/forums/t354325-singlefile-executables.html
     
    Graeme Glass, Jul 25, 2007
    #4
  5. On Jul 25, 6:19 am, Graeme Glass <> wrote:
    > On Jul 25, 8:34 am, NicolasG <> wrote:
    >
    > > Dear fellows,

    >
    > > I'm trying to create a executable file using py2exe . Unfortunately
    > > along with the python executable file it also creates some other files
    > > that are needed in order to the executable be able to run in a system
    > > that doesn't have Python installed. Can some one guide me on how can I
    > > merge all this files created by py2exe in a single exe file ? If I
    > > have a python program that uses an image file I don't want this image
    > > file to be exposed in the folder but only to be accessible through the
    > > program flow..

    >
    > > Regards,
    > > Nicolas.

    >
    > Have you taken a look at cx_Freeze? (http://python.net/crew/atuining/
    > cx_Freeze/)http://www.velocityreviews.com/forums/t354325-singlefile-executables....



    If you're using py2exe (I'm assuming Win32 platform here), you can do
    this but you'll have to read the documentation on how to include the
    library.zip file into the exe. Also there are different levels where
    the .exe file will include the .pyd files. Unfortunately though, you
    will likely encounter errors doing it the more you try to "condense".
    If you can solve this problem, heck tell the guys at py2exe ;-) they
    have been trying to solve this issue for some time now. If you're
    doing it with Linux/Unix, cx_freeze is the only way i know to get this
    done and even then it may have the same limitations. If you're trying
    to hide/proprietize code, you may want to use pyobfuscate.

    Good Luck

    Harlin Seritt
     
    Harlin Seritt, Jul 25, 2007
    #5
  6. NicolasG

    Ali Guest

    On Jul 25, 7:34 am, NicolasG <> wrote:
    > Dear fellows,
    >
    > I'm trying to create a executable file using py2exe . Unfortunately
    > along with the python executable file it also creates some other files
    > that are needed in order to the executable be able to run in a system
    > that doesn't have Python installed. Can some one guide me on how can I
    > merge all this files created by py2exe in a single exe file ? If I
    > have a python program that uses an image file I don't want this image
    > file to be exposed in the folder but only to be accessible through the
    > program flow..
    >
    > Regards,
    > Nicolas.


    Hi,

    I know this is not exactly what you asked for, but if you want a
    single exe installer, then take a look at something like Inno Setup.
    http://www.jrsoftware.org/isinfo.php

    It will package all that stuff into a single exe which Windows users
    seem happy to click-and-install.

    I blogged the process I use here:
    http://unpythonic.blogspot.com/2007/07/pygtk-py2exe-and-inno-setup-for-single.html
    (though this has some PyGTK specifics)

    Ali
     
    Ali, Jul 25, 2007
    #6
  7. NicolasG

    Guest

    On Jul 25, 6:38 am, Ali <> wrote:
    > On Jul 25, 7:34 am, NicolasG <> wrote:
    >
    > > Dear fellows,

    >
    > > I'm trying to create a executable file using py2exe . Unfortunately
    > > along with the python executable file it also creates some other files
    > > that are needed in order to the executable be able to run in a system
    > > that doesn't have Python installed. Can some one guide me on how can I
    > > merge all this files created by py2exe in a single exe file ? If I
    > > have a python program that uses an image file I don't want this image
    > > file to be exposed in the folder but only to be accessible through the
    > > program flow..

    >
    > > Regards,
    > > Nicolas.

    >
    > Hi,
    >
    > I know this is not exactly what you asked for, but if you want a
    > single exe installer, then take a look at something like Inno Setup.http://www.jrsoftware.org/isinfo.php
    >
    > It will package all that stuff into a single exe which Windows users
    > seem happy to click-and-install.
    >
    > I blogged the process I use here:http://unpythonic.blogspot.com/2007/07/pygtk-py2exe-and-inno-setup-fo...
    > (though this has some PyGTK specifics)
    >
    > Ali


    I've been using GUI2Exe, which is a GUI interface to py2exe. Anyway,
    with it, I've been able to reduce the number of files it compiles down
    to 3. The main executable, MSVCR71.dll and w9xpopen.exe. Then I use
    Inno Setup to create an installer executable. Inno can determine if
    any of the dlls you include are already installed and if not, install
    them for you.

    Gui2exe can be found here: http://xoomer.alice.it/infinity77/eng/GUI2Exe.html

    Hope that helps.

    Mike
     
    , Jul 25, 2007
    #7
  8. NicolasG

    Larry Bates Guest

    NicolasG wrote:
    > Dear fellows,
    >
    > I'm trying to create a executable file using py2exe . Unfortunately
    > along with the python executable file it also creates some other files
    > that are needed in order to the executable be able to run in a system
    > that doesn't have Python installed. Can some one guide me on how can I
    > merge all this files created by py2exe in a single exe file ? If I
    > have a python program that uses an image file I don't want this image
    > file to be exposed in the folder but only to be accessible through the
    > program flow..
    >
    > Regards,
    > Nicolas.
    >

    You need to tell us why you "think" you need this and perhaps we can make a
    suggestion. Question: Have you installed ANY applications recently that
    consisted of only a single file on your hard drive? Answer: No. Most
    applications install many (sometimes hundreds) of files. So what is the
    problem. If you want a single file to distribute, look at Inno Installer. Use
    it to make a single, setup.exe out of all the files that come out of py2exe
    along with documentation, shortcuts, etc. that a good modern application needs.

    -Larry
     
    Larry Bates, Jul 25, 2007
    #8
  9. NicolasG

    dbd Guest

    On Jul 25, 10:20 am, Larry Bates <> wrote:
    > NicolasG wrote:
    > > Dear fellows,

    >
    > > I'm trying to create a executable file using py2exe . Unfortunately
    > > along with the python executable file it also creates some other files
    > > that are needed in order to the executable be able to run in a system
    > > that doesn't have Python installed. Can some one guide me on how can I
    > > merge all this files created by py2exe in a single exe file ? If I
    > > have a python program that uses an image file I don't want this image
    > > file to be exposed in the folder but only to be accessible through the
    > > program flow..

    >
    > > Regards,
    > > Nicolas.

    >
    > You need to tell us why you "think" you need this and perhaps we can make a
    > suggestion. Question: Have you installed ANY applications recently that
    > consisted of only a single file on your hard drive? Answer: No. Most
    > applications install many (sometimes hundreds) of files. So what is the
    > problem. If you want a single file to distribute, look at Inno Installer. Use
    > it to make a single, setup.exe out of all the files that come out of py2exe
    > along with documentation, shortcuts, etc. that a good modern application needs.
    >
    > -Larry


    I use a number of utilities that install as a single executable file.
    In fact, that is why I use them. I can install them on systems and
    remove them with simple fast tools and I can count on not leaving any
    extraneous crap behind.

    Utilities can afford to trade off simplicity for the efficiencies in
    memory footprint and programmer time that giant apps must struggle
    for.

    But, not everyone writes utilities. Does this multi-file stance mean
    that there is an automatic assumption that python is only for
    Microsoft wannabes?

    Dale B. Dalrymple
     
    dbd, Jul 25, 2007
    #9
  10. En Wed, 25 Jul 2007 14:20:36 -0300, Larry Bates <>
    escribió:
    > NicolasG wrote:


    >> I'm trying to create a executable file using py2exe . Unfortunately
    >> along with the python executable file it also creates some other files
    >>

    > If you want a single file to distribute, look at Inno Installer. Use
    > it to make a single, setup.exe out of all the files that come out of
    > py2exe
    > along with documentation, shortcuts, etc. that a good modern application
    > needs.


    Exactly. There is even a sample script (located at samples/extending in
    the py2exe installation), it generates automatically the InnoSetup script.
    If you prefer to use NSIS, see this page on the py2exe wiki:
    http://www.py2exe.org/index.cgi/SingleFileExecutable

    --
    Gabriel Genellina
     
    Gabriel Genellina, Jul 25, 2007
    #10
  11. NicolasG

    NicolasG Guest

    > You need to tell us why you "think" you need this and perhaps we can make a
    > suggestion. Question: Have you installed ANY applications recently that
    > consisted of only a single file on your hard drive? Answer: No. Most
    > applications install many (sometimes hundreds) of files. So what is the
    > problem. If you want a single file to distribute, look at Inno Installer. Use
    > it to make a single, setup.exe out of all the files that come out of py2exe
    > along with documentation, shortcuts, etc. that a good modern application needs.
    >
    > -Larry


    I "want" to create a single file for two of my very simple/small
    programs. For very simple/small programs I don't need to distribute
    documentation, shortcuts etc.. I just want a single file to run !
    Another reason is that for another program I wrote has to do with
    displaying an Image file and I want that this image file can be
    visible only through my program and not exposed in the same directory
    where my program is located.

    Thank you all for the suggestions, I will try some methods you
    mentioned.

    Regards,
    Nicolas.
     
    NicolasG, Jul 26, 2007
    #11
  12. En Thu, 26 Jul 2007 03:37:51 -0300, NicolasG <> escribió:

    > I "want" to create a single file for two of my very simple/small
    > programs. For very simple/small programs I don't need to distribute
    > documentation, shortcuts etc.. I just want a single file to run !


    See http://www.py2exe.org/old/#the-bundle-option

    --
    Gabriel Genellina
     
    Gabriel Genellina, Jul 26, 2007
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Piet
    Replies:
    2
    Views:
    334
  2. Podi
    Replies:
    2
    Views:
    975
  3. Replies:
    15
    Views:
    491
    Dave Thompson
    Aug 21, 2006
  4. pratap
    Replies:
    20
    Views:
    762
    Flash Gordon
    Mar 7, 2007
  5. Replies:
    0
    Views:
    444
Loading...

Share This Page