diff --git a/.devops/start.sh b/.devops/start.sh index 5458337..2fe5057 100755 --- a/.devops/start.sh +++ b/.devops/start.sh @@ -16,9 +16,20 @@ if ! command -v python3 &> /dev/null; then exit 1 fi -# 检查依赖 -echo "检查 Python 依赖..." -pip3 list | grep -q PyYAML || pip3 install PyYAML +# 检查依赖(如果在虚拟环境中,跳过系统级安装) +if [ -z "$VIRTUAL_ENV" ]; then + echo "检查 Python 依赖..." + if ! python3 -c "import yaml" 2>/dev/null; then + echo "警告: 未找到 PyYAML,尝试安装..." + pip3 install --user PyYAML || echo "请手动安装: pip3 install --user PyYAML" + fi +else + echo "检测到虚拟环境: $VIRTUAL_ENV" + if ! python3 -c "import yaml" 2>/dev/null; then + echo "安装 PyYAML..." + pip install PyYAML + fi +fi # 进入项目根目录 cd "$PROJECT_ROOT"