Non-interpreted Python?

Peter Hansen peter at engcorp.com
Mon Sep 23 15:04:04 EDT 2002


Tapio Kelloniemi wrote:
> 
> I'm new to Python and would like to know, wheter it is possible to
> compile Python code to binary executables (and on which platforms)? 

Yes, at least on Linux and Win32, if you are not expecting large increases
in performance as a result.  This is done by "freezing" the bytecode files
and bundling them into a single executable, usually with the libraries
(.DLL or .so as appropriate) bundled but separate.

There are other approaches, but there's no point describing them until
you explain *why* you want to do this.  What are your requirements?

> Or better, if it is possible to compile code into object format and then
> link with C/C++/whatever code.

Python has excellent facilities for embedding in applications written
in C/C++.  Check the documentation for the relevant sections.

-Peter



More information about the Python-list mailing list