Python compiled code
File type: Source code and script file
A .pyo file contains optimized bytecode compiled from Python source code. This legacy file type is associated with Python 2.
File type category:
Source code and script file
Date updated: November 24, 2026
Python is a dynamic, object-oriented programming language used for many kinds of software development, with support for integration with other languages and tools. In Python 2, a .pyo file stores optimized bytecode for a Python module or script.
The Python 2 interpreter generated these files when run with optimization enabled. Optimization can remove assert statements and code that runs only when __debug__ is true; a higher optimization level can also remove docstrings. A .pyo file contains compiled code, not the original Python source.
Python 2 is obsolete, and Python 3.5 and later no longer use the .pyo extension. They store optimized bytecode in .pyc files instead, with the optimization level indicated in the filename. A .pyo file requires a compatible Python 2 interpreter, available for Windows and other platforms.
Run the file with a compatible Python 2 interpreter, for example by passing its path to the Python command. Python 3 cannot run .pyo files. The file contains bytecode rather than readable source, so a text editor will not display it as a normal Python script.
There is no reliable direct conversion from a .pyo file to its original Python source. The bytecode does not preserve all source details, and optimization may remove code or docstrings. If the original .py source is available, run it with the intended Python interpreter to generate bytecode for that version.
application/x-python-bytecodeSoftware applications that can open pyo files:
Microsoft Windows
Software applications that can edit pyo files:
Microsoft Windows
Software capable of saving pyo files:
Microsoft Windows
Software apps that create pyo files:
Microsoft Windows
Software applications that handle other tasks involving pyo files:
Microsoft Windows
Online conversions and file conversion information are provided by 101convert.com.