Re: Are .pyc files portable?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wubbulous@gmail.com

    #1

    Re: Are .pyc files portable?

    Python compiles to bytecode, which means that pyc files can be
    interpreted by any Python executable regardless of platform.

    As for manual compilation to directories, the py_compile module is the
    one you want. Here's an example program to plug in.

    #test_compile.p y#

    import py_compile

    print "hello"
    py_compile.comp ile("test_compi le.py", "C:\test_compil e.pyc")


    The manual page for py_compile.comp ile() can be found on this page:


    Hope that helps.
    Cheers,
    Wubbulous
  • Steven D'Aprano

    #2
    Re: Are .pyc files portable?

    On Fri, 07 Nov 2008 19:01:31 -0800, Wubbulous wrote:
    Python compiles to bytecode, which means that pyc files can be
    interpreted by any Python executable regardless of platform.
    No, bytecode isn't compatible from one version number to another.



    --
    Steven

    Comment

    Working...