The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Python Programming
|
How to convert .py to .exe?
Discuss How to convert .py to .exe? in the Python Programming forum on Dev Shed. How to convert .py to .exe? Python Programming forum discussing coding techniques, tips and tricks, and Zope related information. Python was designed from the ground up to be a completely object-oriented programming language.
|
|
 |
|
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

October 17th, 2003, 03:13 PM
|
|
Junior Member
|
|
Join Date: Feb 2003
Posts: 12
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
How to convert .py to .exe?
I installed python and py2exe.How can I use py2exe to convert py file to exe file?Thank you.
|

October 17th, 2003, 04:13 PM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
|
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne
|

October 17th, 2003, 04:17 PM
|
|
Junior Member
|
|
Join Date: Feb 2003
Posts: 12
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Thanks.A question:What should I put "python setup.py py2exe"?Inside the code?
|

October 17th, 2003, 04:24 PM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
|
No, you run that from the command line.
|

October 17th, 2003, 07:17 PM
|
|
Junior Member
|
|
Join Date: Feb 2003
Posts: 12
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
run from Python command?
|

October 17th, 2003, 08:24 PM
|
|
Junior Member
|
|
Join Date: Oct 2003
Location: Tucson AZ
Posts: 29
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
from the command line you would type:
"python setup.py py2exe"
This will launch setup.py, setup.py will tell py2exe which python file you want to convert to an exe
|

October 17th, 2003, 08:52 PM
|
|
Junior Member
|
|
Join Date: Feb 2003
Posts: 12
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
I saved my work at D:\abc1\abc1\, then i tried to type "c:\python23\python.exe d:\abc1\abc1\setup.py py2exe".The program I made run,but in the command-line,there are some lines said:
running py2exe
running build
running build_scripts
error file 'abc.py' does not exist.
Also,I couldn't find the .exe file.
This is my seutp.py file:
# setup.py
from distutils.core import setup
import py2exe
setup(name="abc",
scripts=["abc.py"],
)
Thanks a lot.
|

October 18th, 2003, 12:12 AM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
|
Do you actually have a file called abc.py somewhere or did you just make that up?
|

October 18th, 2003, 12:15 AM
|
|
Junior Member
|
|
Join Date: Feb 2003
Posts: 12
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
i have the abc.py file which is in the same folder as setup.py.that's why i am confused about it.
Is my command right?
|

October 18th, 2003, 12:21 AM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
|
Ok, then do this instead.
1. Go to the dos command prompt. This can be done by going to Start-->Run... and typing "cmd" (or "command" for Windoze 98) and then hitting enter.
2. On the DOS window, type the following:
d:
cd \abc1\abc1
c:\python23\python.exe setup.py py2exe
See if that helps you.
|

October 18th, 2003, 12:40 AM
|
|
Junior Member
|
|
Join Date: Feb 2003
Posts: 12
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Thank you so much.It looks working.After I run the command you gave me,there are so many lines coming out.it seems to add some news files in my abc\abc folder.Also,a new folder has been created : dist\abc\.some files like python23.dll and abc.exe are there.Does it mean py2exe successfully?
Thanks a lot.
|

October 18th, 2003, 12:41 AM
|
 |
Banned ;)
|
|
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
|
|
If you didn't see any error messages, then it must have been successful 
|

October 18th, 2003, 12:44 AM
|
|
Junior Member
|
|
Join Date: Feb 2003
Posts: 12
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Thank you.Wow!This is the first time I did py2exe.What I did before is run the command under C:,not in my program's folder.Now I understand it.
|

October 18th, 2003, 03:22 AM
|
|
Junior Member
|
|
Join Date: Feb 2003
Posts: 12
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
I also have a question: when I run the program that I made,the DOS windows always comes out.How can I remove it?
|

October 18th, 2003, 06:25 AM
|
 |
Hello World :)
|
|
Join Date: Mar 2003
Location: Hull, UK
|
|
|
There are two ways that i know of to do this, 1 you could us the -w flag from the command line, something like..
python setup.py py2exe -w
2, give your python program a .pyw extension (abc.py becomes abc.pyw)
Mark.
__________________
programming language development: www.netytan.com – Hula
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|