Generating .pyo from .py

Discussion in 'Python' started by skn, Jun 16, 2005.

  1. skn

    skn Guest


    Does the python compiler provide an option to generate a .pyo(optimized byte
    code file) from a .py (source file)?

    For generating .pyc I know that I only have to pass the source file name as
    an argument to
    But for generating .pyo, I could not find anything.

    Any clues/help will be greatly appreciated.

    With best regards,
    skn, Jun 16, 2005
    1. Advertisements

  2. skn

    Maurice LING Guest

    say your code is "" and you usually run it as "python",
    then the "-O" option will generate .pyo files.
    That is "python -O"

    Cheers maurice
    Maurice LING, Jun 16, 2005
    1. Advertisements

  3. checks __debug__ to decide whether to use optimize mode,
    and the -O option to Python turns __debug__ off, so:

    python -O
    Leif K-Brooks, Jun 16, 2005
  4. skn

    skn Guest

    Thanks a lot !!
    It works fine !!


    skn, Jun 20, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.