Python executables?

Ben Finney bignose-hates-spam at and-zip-does-too.com.au
Thu Jun 26 19:34:22 EDT 2003


On Thu, 26 Jun 2003 12:37:23 +0300, Catalin wrote:
> How can I make executables with python?

Python scripts are executable, so long as they can be fed through the
Python interpreter.

> I found some utilities that claim they can do something like that like 
> Installer and py2exe but they actualy pack the code in a huge arhive! 

Yes.  Python scripts are always interpreted (more accurately, compiled
at run-time to a Pytohn-specific bytecode, then interpreted).  You can
bundle the scripts and interpreter into a huge bolus, but that only
eases transmission and installation, it doesn't prevent Python being
interpreted.

> This solves the problem of giving python programs to users who don't 
> have python but doesn't solve the problem of the source "secrecy" 
> (copyright).

Wrong problem.  If you want to hide your source code from your users,
don't expect help from free software programmers.

> And the programs also run much slower and become extremely big compared 
> to a normal C++ program for example.

Yes.  Python emphasises programmer time (both the writer and the reader)
as being more valuable than CPU time.  If you want something as fast as
platform-bound machine-code, use something that generates platform-bound
machine-code, like C.

(That said, much of PYthon's CPU-intensive tasks are actually
implemented as C modules, but only where the performance gain outweighs
the loss of Python code.)

> So can a python program become a "real" executable(I am refering both
> to windows and unix platforms)?

No executable bound to a particular execution model (i.e. compiled to
interface with one OS and CPU architecture) can execute on any other
architecture directly.

> If this is imposible with python is it possible with jpython?

With Jython, you still have an interpreted lagnuage, being compiled at
run-time to a bytecode and then interpreted.  This brings all the
performance bottlenecks you complained of.  (More experienced Jython
people will probably correct me on details, but it doesn't change the
fact that Jython isn't going to be as fast as platform-bound
machine-code.)

-- 
 \          "It is well to remember that the entire universe, with one |
  `\       trifling exception, is composed of others."  -- John Andrew |
_o__)                                                           Holmes |
http://bignose.squidly.org/ 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B




More information about the Python-list mailing list