This is a program that compiles every .py file in the Python directory. Please note that it only works if you set Python's directory to C:\Python24. If you are using an older version or customized your directory choice. I am not sure what opperating systems it will work on, but I know it will work on win32.
from compileall import compile_dir; compile_dir("C:/Python24/")