Follow the previous post instructions if you don't have Python 2.2.2 installed on your system.

import py_compile
 
py_compile.compile("mymodule.py")