My understanding is that as long as python can find the .py files it will automatically compile .pyo and .pyc files as needed (on module import). I know for sure that for any .pyo/.pyc files for your own python code you can erase them completely safely, I do that all the time.
If you're talking about the system files, I would be a little careful, and at least make sure that the .py file exists for any .pyo/.pyc file you want to erase. I just ran a test where I moved /usr/lib/python2.6/xmllib.pyc and ran python and imported xmllib(I chose the module totally at random) and the .pyc file wasn't recreated, but the module imported fine. I did the same thing as root, and the .pyc file was recreated, so this would suggest that the process is fairly safe, at least if you have the .py files.
As a side note, you can use the -B command line argument to python, or
Code:
sys.dont_write_bytecode = True
if you want your code not to write bytecode for imported modules. This leads to the obvious performance penalty.
Anyway, I can't make any guarantees, but my quick test suggests you should be fine. I might run a similar test with a .pyo file just to be paranoid - and of course don't erase any bytecode files if you don't have th corresponding .py file somewhere! Also, don't expect to free up much space this way! I checked on my own system and across two python installs (one on windows and one in linux) all my .pyc and .pyo files combined add up to less than 100M!