#!/bin/bash # 获取脚本所在路径 SCRIPT_DIR=$(dirname "$(readlink -f "$0")") # 切换到脚本所在路径 cd "$SCRIPT_DIR" || { echo "Failed to change directory to $SCRIPT_DIR"; exit 1; } # 清除所有 __pycache__ 目录 echo "Removing __pycache__ directories..." find . -type d -name "__pycache__" -exec rm -rf {} + # 清除所有 .pyc 文件 echo "Removing .pyc files..." find . -type f -name "*.pyc" -exec rm -f {} + echo "Cleanup complete. All __pycache__ directories and .pyc files have been removed."