Skip to content

Instantly share code, notes, and snippets.

@technocake
Last active February 20, 2024 01:56
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save technocake/40b00d695e746a43926a88e531ab5548 to your computer and use it in GitHub Desktop.
Save technocake/40b00d695e746a43926a88e531ab5548 to your computer and use it in GitHub Desktop.
Clear all python cache in directory
# pyclean command to clear all python cache in a directory
# source: https://stackoverflow.com/questions/28991015/python3-project-remove-pycache-folders-and-pyc-files
# in .bash_profile / .bash_rc etc put:
pyclean () {
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
}
# Now to delete all python cache in a directory do:
cd path/to/directory
pyclean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment