From 238d0276d8acacbed34e05e8cac941e8655667cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B0=8F=E4=BA=91?= Date: Fri, 9 Jan 2026 17:46:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=90=AF=E5=8A=A8=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=E4=BB=A5=E6=94=AF=E6=8C=81=E8=99=9A=E6=8B=9F=E7=8E=AF?= =?UTF-8?q?=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .devops/start.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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"