Page 1 of 1

Python compiler

Posted: Tue Mar 16, 2004 2:32 pm
by Aleksander Helgake
Can you compile python code or do you have to distribute the py files and tell people to use an intepreter?

Re:Python compiler

Posted: Tue Mar 16, 2004 4:07 pm
by Nychold
Generally speaking, Python is a scripting language, meaning it is interpreted from the source code. A compiled language (like C or Pascal) is compiled down to machine code for a specific machine. Other languages like Java act as both: they are compiled into a special byte-code which is later interpreted by a program called a Virtual Machine.

I don't know of any Python compiler, but that doesn't mean one doesn't exist. If one does exist, you could certainly use that rather than the standard Python tools, which would mean your Python code would run on one and only one system; in the case of a VM, perhaps on many systems, but with unreadable code.

Re:Python compiler

Posted: Tue Mar 16, 2004 5:46 pm
by chris
I think what you want is a Frozen Binary. Frozen Binary executables are packages that combine your script's byte code and the Python interpreter into a single executable program. With these, scripts can be launched in the same ways that you would launch any other executable program.

Try here: http://sourceforge.net/projects/py2exe/

Btw, you can also distribute your script in the byte code format (.pyc) if you don't want others to use/read your source.