How to compile a python script to *.pyo

danny at iamlearning.com danny at iamlearning.com
Thu Apr 3 21:43:34 EST 2003


>
> I'll ignore the why's and wherefore's and give you what I consider a
> straight answer.....
>
> pydoc compileall
>
>   Python Library Documentation: module compileall
>
> NAME
>      compileall - Module/script to "compile" all .py files to .pyc (or
> .pyo) file.
>
> FILE
>      /usr/local/lib/python2.2/compileall.py
>
> DESCRIPTION
>      When called as a script with arguments, this compiles the
> directories given as arguments recursively; the -l option prevents
> it from recursing into directories.
>
>      Without arguments, if compiles all modules on sys.path, without
> recursing into subdirectories.  (Even though it should do so for
> packages -- for now, you'll have to deal with packages separately.)
>
>      See module py_compile for details of the actual byte-compilation.
>
> FUNCTIONS
>      compile_dir(dir, maxlevels=10, ddir=None, force=0, rx=None)
>          Byte-compile all modules in the given directory tree.
>
>
> .....  snip .....
>
>
>
> I use this for yes you've guessed it compiling my applications, on the
> fly as they are installed.
>
>
>
> Regards
> Martin

For Martin,
Thanks for your advice. That's what I need.
If this mailing list got more people like you, there are less junk
messages to read.











More information about the Python-list mailing list