April 13th, 2005, 03:46 PM
So last night i got Python downloaded on my comp, and i was all excited to start learning. I read the first few sections of the docs they have on the python site, and got slowly more and more confused. Here is the thing...im starting to get a grasp on how the language works and what you can do in it but im still not sure how you would go about compiling an executable in python...this is a very noobish question i know, but im just confused right now. Any help would be really appreciated.
April 13th, 2005, 04:08 PM
Actually the question isn't noobish. You need a compiler to make windows executables out of your Python programs. For windows, I would suggest using py2exe. You can find the main site through a quick search in google. I think the post at the top of this section as a link to a small tutorial on how to use py2exe. It's very easy to use, and very useful distributing your Python programs.
April 13th, 2005, 04:12 PM
Ok thanks, is there any way to program for multiple OS's? Id like to make Windows, Mac, and Linux compatible programs in an ideal world...
April 13th, 2005, 04:20 PM
Yes. py2app is made for making executable applications for Mac. I'm pretty sure there is one for Linux, however I don't know the name. Try searching google for python linux executable.
April 13th, 2005, 04:27 PM
April 13th, 2005, 05:36 PM
Yay, i got it up and working. Just succesfully compiled and ran a hello world program! Go me!
April 13th, 2005, 05:42 PM
April 13th, 2005, 06:16 PM
It is a noobish question; noobs always seem ask how to make exe's...
Originally Posted by Max Dismukes
Well, typically, you don't. Building EXEs is a red herring brought from other languages that require it. Not needed and cumbersome, mostly. See:
That's how Python is cross-platform compatible and fast to develop in - because you never need to go through a compile/build stage, and it never targets a particular OS. It just targets Python. Have Python installed on your linux box? Just copy the .py file over and run it. Same with the Mac. Same with the PocketPC, and in the future (hopefully) same with IronPython.
Yes, this does mean you need to have Python installed to run programs, and if you have written a program that you wish to distribute, /then/ start looking for py2exe as a last step. But not until then, as it will only get in the way most of the time and is, for your normal use (as you have Python), completely unnecessary.
Just double-click on a .py file and it will run. Or rename it to .pyw if you want it to run without the DOS window visible. Or start it from the command line, as if it was any other program. Or make a shortcut to it.
Last edited by sfb; April 13th, 2005 at 06:22 PM.
April 14th, 2005, 11:35 AM
Don't be mean sfb(does it matter)
Anyway you could also just keep the scripts in .py or whatever and have the python installd on the computer
April 14th, 2005, 01:26 PM
I wasn't being mean; that's proper friendly sales talk, that is.
Originally Posted by monkeyman23555
It just happens that it is a noobish question. That doesn't have to be taken as an insult, however, just an observation. Check the forum history and newsgroups, if you look in the same places I have, you see that "How do I make EXEs" is said mostly by people new to Python.
I'd say it's far meaner to act as if Py2EXE is a typical everyday thing used to write Python software when in fact it's a separate module used occasionally when a project is done, dusted, and someone you can't convince has complained about needing Python.
It adds significantly to development effort, program complexity, filesize and time. I suggest (quite strongly) that you not bother with it until you need to.
Last edited by sfb; April 14th, 2005 at 01:28 PM.
April 14th, 2005, 02:25 PM
Ya whatever you say I was a noob one day and you too so... Guess he could be much better then you in 10 years
April 14th, 2005, 03:24 PM
He may not be programming [Python] in 10 years from now. I hope to stay with Python forever, it is by far my most favorite language.