pythonversion-controldelete-filetemporary-files

Remove __pycache__ folders and .pyc files from Python project


What is the best way to clear out all the __pycache__ folders and .pyc/.pyo files from a Python project?

I have seen multiple users suggest the pyclean script bundled with Debian, but this does not remove the folders. I want a simple way to clean up the project before pushing the files to my DVS.


Solution

  • Running py3clean . cleaned it up very nicely.


    Make sure you do not accidentally mistype pyclean as pycclean, otherwise you will get this error:

    No command 'pycclean' found, did you mean:
      Command 'py3clean' from package 'python3-minimal' (main)
      Command 'pyclean' from package 'python-minimal' (main)
      pycclean: command not found