python3 -m py_compile script.py

Category: Python & pip

python3 -m py_compile script.py

Compile script.py to bytecode and report syntax errors

Compiles a script to bytecode and reports any syntax errors without running it.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.