Is there a way to create a bin file of a Python program?
I want a bin file like when you compile a program from source.
Thanks
Is there a way to create a bin file of a Python program?
I want a bin file like when you compile a program from source.
Thanks
Since python is a scripting language, it doesn't produces binaries. It is compiled at run-time.
Tho, you still can get some .pyc files, as I understood those are semi-compiled files. Unless you want to close the sourcre from being seen/edited, I don't see why someone would do such a thing, tho.
Smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
Binary for which platform? There are compilers, which can compile .pyc further to real binaries (like psyco), but not many people bothers with it. Why you need it?
BTW .pyc files are compiled to intermediate code, so they can be executed rather efficiently. They are not interpreted at the runtime like classic "scripting" language do, whatever "scripting" means.
Smart questions: http://www.catb.org/~esr/faqs/smart-questions.html
There are python "compilers" out there that wrap up all your modules and the interpreter into an executable. I've found this useful for distributing software to Windows users, although you can also get "compilers" for linux,BSD,OSX etc.
One thing you do need to be aware of if you are thinking of distributing .pyc files is that the .pyc file format is interpreter-dependent, so if you have python 2.4 and you give your pyc files to someone with python 2.1 they probably won't run.
This can also be a problem for code, Python is a fairly new language and as such it's changing constantly. The only way to ensure your app will continue to run on later versions of python is to package it as above so it is run on the correct interpreter. Of course, most apps should continue to run fine (unless they do decide to remove lamda: and map.)
p.s. Psyco isn't a packager, but a JIT compiler that kind of reduces the cost of python's dynamic typing.
Last edited by evymetal; October 29th, 2007 at 09:54 AM. Reason: addition
Python is actually 16 years old.
There is a setup.py script out there... I use it for KernelCheck.
The one and only, Master Kernel Thread
KernelCheck - Finally. A way to easily download, compile, and install the latest kernel. Release 1.2.5 available now.
Bookmarks