Cross compile generation of .pyc from .py files...

David Wahler dwahler at gmail.com
Wed Mar 1 16:00:43 EST 2006


venkatbo at yahoo.com wrote:
> I was under the impression, that the .pyc files will be used (if found)
> by python to speed up execution of scripts... and so we packaged,
> deployed and installed the .py/.pyc files on to the ppc-target system.
> That package includes, site.py(c), types.py(c) etc., among others.
>
> Though I see these errors when I invokde 'python -v', I'm able to
> execute the .py files... but was hoping to use the .pyc files to
> benefit from the enhanced speed of execution.
[snip...]

.pyc files do not increase the speed of execution -- only the speed of
importing modules. Even then, the benefit is only seen the first time
the modules are loaded, as the .pyc files will be generated
automatically. I'd say the tiny, one-time speedup isn't worth it; and
if you really want the modules to be precompiled, it's better to do it
at installation time using distutils.

-- David




More information about the Python-list mailing list