Reputation: 13672
I have a Python directory with a number of .py files. I recently compiled them into .pyc files using python -m compileall
. I have now changed some of the source files and would like to recompile, writing over the old .pyc files.
Is there a quick way to do this from the command line without having to manually delete all existing .pyc files?
Upvotes: 8
Views: 22231
Reputation: 8061
You just have to run python -m compileall
again. It will overwrite older .pyc files. You can pass it the -f
switch to force rebuild even if timestamps are up to date (as per the documentation).
Upvotes: 9
Reputation: 53873
When the source code has changed, new .pyc files are automatically created when you run the program again. Therefore I wouldn't worry about compiling, but focus your attention on the code itself.. :)
Upvotes: 4