Search code examples
pythonbytecodebackwards-compatibilitypyc

Python 2 and 3, are the bytecode (pyo & pyc) backward compatible?


Python 2 and 3, are the bytecode (pyo & pyc) backward compatible?

can i execute python 2 pyo & pyc file with python 3?


Solution

  • No, they are usually not even compatible between minor releases (e.g. 2.6 vs 2.7).
    However, since you usually have the .py files, too, python will automatically compile them for the currently used version.