In order to compile a document you must save the file and give it a name of anything you would like.
For example we will name ours PYCompile.py (.py is not needed to be placed at the end as once saved through the IDLE environment it will automatically add this extension.)
Now comes a bit of some trouble.
It is always best to execute this compile based on the documents that are being stored on the Desktop. Python has a very specific set of folders that it will begin to search into and look for the name of your compiled file in order to begin doing work on it. Now in your Python shell you will needed to import the module of py_compile
Next Step
The outputted file will be stored in a __pycache__ folder depending on how your version of Python IDLE was installed originally. (Mine for example gets stored in Documents)
In this folder you will see 'PYCompile.cpython-35.pyc'. This file allows you to launch the application and it will execute the commands in the py file. A little note is once it is compiled it can not be manipulated.
Also that '.cpython-35' at the end of the compiled file indicated the version in which the file was compiled on. Usually users do not leave this attached their file name but it is a helpful piece of information if they had left it attached to their filename.
Good luck.
If you have any questions, comments or concerns feel free to contact me using the form below.