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?
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).
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.. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With