Recompile all Python files in directory
compiler-construction, python
Solution
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).
Problem
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?