From 30f3ae66a4de5143859bafb684e30f5c4e75f80c Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Thu, 23 Jul 2026 19:08:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20pip=20=E5=AE=89=E8=A3=85=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E6=9C=89=E6=98=8E=E7=A1=AE=E6=8F=90=E7=A4=BA=EF=BC=8C?= =?UTF-8?q?fallback=20=E6=A1=A5=E6=8E=A5=E7=94=A8=E6=88=B7=20site-packages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/deploy/install.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/deploy/install.sh b/scripts/deploy/install.sh index fab7bd1..889c2e2 100644 --- a/scripts/deploy/install.sh +++ b/scripts/deploy/install.sh @@ -57,7 +57,17 @@ fi # 安装 Python 依赖(全局,root 可访问) if [ -d "$INSTALL_DIR/deps" ] && ls "$INSTALL_DIR/deps"/*.whl >/dev/null 2>&1; then - pip3 install "$INSTALL_DIR"/deps/*.whl 2>&1 || true; echo " ✓ Python 依赖已就绪" + if pip3 install --force-reinstall "$INSTALL_DIR"/deps/*.whl 2>&1; then + echo " ✓ Python 依赖已安装" + else + echo " ⚠ Python 依赖安装失败,尝试桥接用户包..." + # Fallback: let root's Python see the current user's site-packages + USER_SITE=$(python3 -c "import site; print(site.USER_SITE)" 2>/dev/null) + if [ -n "$USER_SITE" ] && [ -d "$USER_SITE" ]; then + SYS_SITE=$(python3 -c "import site; print(site.getsitepackages()[0])" 2>/dev/null) + echo "$USER_SITE" > "$SYS_SITE/orangepi-local.pth" 2>/dev/null && echo " ✓ 用户包桥接已创建" || echo " ⚠ 桥接失败" + fi + fi fi # 安装/更新服务