Skip to main content
1 of 5
Eric O. Lebigot
  • 95.1k
  • 49
  • 223
  • 263

Python has a built-in compiler (to byte-code):

python -OO -m py_compile <your program.py> 

produces a .pyo file that contains byte-code, and where docstrings were removed, etc. You can rename the .pyo file with a .py extension, and python <your program.py> runs like your program but does not contain your source code.

Eric O. Lebigot
  • 95.1k
  • 49
  • 223
  • 263