FileInfo

Idiomas

Visión General

What is a PYO file? A PYO file contains optimized bytecode compiled from a Python code ( .PY ) file that is executed by the Python interpreter . It is similar to a .PYC file, which is a compiled Python script , but is generated when Python is run with optimization flags ( -O or -OO ), which remove assert statements and may reduce debugging information to improve performance.

More Information Optimization flags in Python are command-line options used to modify how the Python interpreter compiles and runs code. They primarily affect performance, debugging information, and error handling. The most common optimization flags are: -O (Single Optimization): Removes assert statements (a debugging tool used to check if a condition is true) and creates optimized bytecode files (PYC instead of PYO in Python 3.5 and later). -OO (Aggressive Optimization): Does everything -O does but also removes docstrings to reduce file size. Python used PYO files in versions of Python up to 3.5, but they have since been deprecated. Modern Python versions handle optimization differently, storing all compiled bytecode as PYC files within the __pycache__ directory and applying optimizations based on file naming conventions. If working with an older Python project, you may still encounter PYO files, but newer projects use PYC files for optimized execution.

Popularity3.5/5

22 votes

Quick AppOpen with
VerifiedVerified by FileInfo.com The FileInfo.com team has independently researched the Python Optimized Code file format and Mac, Windows, and Linux apps listed on this page. Our goal is 100% accuracy and we only publish information about file types that we have verified. If you would like to suggest any additions or updates to this page, please let us know .

Python Software Foundation Python 3.4 Icon

Migas de pan

DeveloperPython Software Foundation
Popularity3.5 | 22 Votes

Previous / Next

In-Depth

.PYO File Extension

Python Optimized Code

DeveloperPython Software Foundation
Popularity
3.5  |  22 Votes
 

What is a PYO file?

A PYO file contains optimized bytecode compiled from a Python code ( .PY ) file that is executed by the Python interpreter . It is similar to a .PYC file, which is a compiled Python script , but is generated when Python is run with optimization flags ( -O or -OO ), which remove assert statements and may reduce debugging information to improve performance.

More Information

Optimization flags in Python are command-line options used to modify how the Python interpreter compiles and runs code. They primarily affect performance, debugging information, and error handling. The most common optimization flags are:

Python used PYO files in versions of Python up to 3.5, but they have since been deprecated. Modern Python versions handle optimization differently, storing all compiled bytecode as PYC files within the __pycache__ directory and applying optimizations based on file naming conventions. If working with an older Python project, you may still encounter PYO files, but newer projects use PYC files for optimized execution.

How to open a PYO file

You can run PYO files with older versions of Python (before 3.5). For example, to run a PYO file with an older version of Python in a terminal, execute the following command:

python -O example_script.pyo

Open over 400 file formats with File Viewer Plus . Free Download

Programs that open PYO files

Sort

Pricing

Program Name

Platform

Reset

X

Windows

Python Software Foundation Python

Free

Mac

Python Software Foundation Python

Free

Linux

Python Software Foundation Python

Free

Category: Executable Files

Updated: February 20, 2025

Preguntas Frecuentes

What is a PYO file?
A PYO file contains optimized bytecode compiled from a Python code (.PY) file that is executed by the Python interpreter. It is similar to a .PYC file, which is a compiled Python script, but is generated when Python is run with optimization flags (-O or -OO), which remove assert statements and may reduce debugging information to improve performance.
How do I open a .pyo file?
You can run PYO files with older versions of Python (before 3.5). For example, to run a PYO file with an older version of Python in a terminal, execute the following command: