首页 > 解决方案 > 如何访问 _pycache_ 目录

问题描述

我想删除一个文件夹,但我无法进入pycache删除pyc和 pyo$ 文件。我以前做过,但我不知道我是怎么做到的。

标签: pythonbash

解决方案


如果您想删除python文件工件,例如.pyc.pyo缓存文件,也许您可​​以尝试以下操作:

  1. 移动到项目的根目录

    cd <path_to_project_root>

  2. 删除 python 文件工件

    find . -name '*.pyc' -exec rm -f {} + find . -name '*.pyo' -exec rm -f {} +

希望这会有所帮助!


推荐阅读