How to create a single executable of a Python program

N

NicolasG

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.
 
H

hong2221

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.
 
G

Graeme Glass

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
 
H

Harlin Seritt



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
 
A

Ali

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
 
K

kyosohma

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
 
L

Larry Bates

NicolasG said:
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
 
D

dbd

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
 
G

Gabriel Genellina

NicolasG wrote:
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
 
N

NicolasG

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top