From a8b490eea3afebf799866c22b2054a96adf653c6 Mon Sep 17 00:00:00 2001 From: Peanut Date: Fri, 22 May 2026 18:16:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Windows=20=E4=B8=8B=E5=AD=90=E8=BF=9B?= =?UTF-8?q?=E7=A8=8B=20python3=20=E5=91=BD=E4=BB=A4=E4=B8=8D=E5=AD=98?= =?UTF-8?q?=E5=9C=A8=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Windows 上没有 python3 命令,只有 python。使用 sys.executable 作为当前 Python 可执行文件路径,兼容 Windows 和 Linux/Mac。 Co-Authored-By: Claude Opus 4.7 --- deploy.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/deploy.py b/deploy.py index c8f4941..27b4edf 100644 --- a/deploy.py +++ b/deploy.py @@ -32,6 +32,9 @@ if hasattr(sys.stdout, 'buffer'): sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace', line_buffering=True) sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='replace', line_buffering=True) +# 当前 Python 可执行文件(Windows 用 python.exe,Linux/Mac 用 python3) +PYTHON = sys.executable + # ============================================================================ # 配置 # ============================================================================ @@ -212,7 +215,7 @@ def deploy_backend(): log_info("执行后端部署...") ok, _, err = run_command( - "python3 deploy.py remote", + f"{PYTHON} deploy.py remote", cwd=str(PROJECT_DIR / "backend-single"), timeout=600, capture=False @@ -240,7 +243,7 @@ def deploy_frontend(): log_info("执行前端部署...") ok, _, err = run_command( - "python3 deploy.py", + f"{PYTHON} deploy.py", cwd=str(PROJECT_DIR / "web"), timeout=600, capture=False @@ -268,7 +271,7 @@ def deploy_admin(): log_info("执行管理后台部署...") ok, _, err = run_command( - "python3 deploy.py", + f"{PYTHON} deploy.py", cwd=str(PROJECT_DIR / "web-admin"), timeout=600, capture=False @@ -296,7 +299,7 @@ def deploy_life_script(): log_info("执行 Life-Script 部署...") ok, _, err = run_command( - "python3 deploy.py", + f"{PYTHON} deploy.py", cwd=str(PROJECT_DIR / "life-script"), timeout=600, capture=False