[Tutor] Python to exe--how much work?

Alan Gauld alan.gauld at btinternet.com
Wed Jun 25 00:09:45 CEST 2008


"Keith Suda-Cederquist" <kdsudac at yahoo.com> wrote

> Question: How hard is it to convert python code to an exe?

Not too hard if you know computers. Quite hard for a complete
novice. py2exe seems to be the most popular option.

> Details: I've written some test software in python for my company.
> We'd like to be able to distribute the software without having to
> install python on the instrument computer.

If you'd written it in Java would you use a native compiler for Java
or just install the JRE on the target PC? If you used .NET would
you insist on compiling the C# to exe or just install .NET on the
target? Why not do the same for python?

> The software itself is several hundred lines of code,

If you said 10s of thousands of lines I might be concerned.
Hundreds is near trivial.

> that imports and uses several modules: SciPy, NumPy,
> PIL (python imaging library) and matplotlib.

I'm not aware of anty issues with those modules/libraries
but you never know till you try!

> harder will this be for longer code with more modules imported?

For a few hundred lines it shouldn't be much harder.

> 3) We could have someone in-house port the code to C or VB.

That shouldn't really be needed, it would be much cheaper and
more reliable to just install Python - its not very big and thats
all the exe 'copilers' do anyway. They just package the interpreter
and libraries into a self launching file! In fact if you are going to 
have
several such scripts you really should install Python, it will take
up much less room and resource than installing a version of
Python for each script!

[ You may have gathered that I'm not a big fan of compiling python
  to exe's - I've rarely seen a valid case for it :-]

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 




More information about the Tutor mailing list