From ccdc1011926a070b9065bddf93fe43e48bacf289 Mon Sep 17 00:00:00 2001 From: JOJO <1498581755@qq.com> Date: Mon, 20 Jul 2026 15:53:16 +0800 Subject: [PATCH] =?UTF-8?q?chore(terminal):=20=E5=88=A0=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E7=9A=84=20=5Fderive=5Fpip=5Ffrom=5Fpython?= =?UTF-8?q?=20=E6=AD=BB=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/terminal_ops/python.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/modules/terminal_ops/python.py b/modules/terminal_ops/python.py index d9a7f538..74de26b8 100644 --- a/modules/terminal_ops/python.py +++ b/modules/terminal_ops/python.py @@ -64,22 +64,6 @@ class PythonMixin: return self._detect_system_python() - @staticmethod - def _derive_pip_from_python(python_path: str) -> str: - """ - 根据 python 可执行文件推导匹配的 pip,可避免“python 在 venv、pip 却指向系统”。 - 若同目录下找不到 pip3/pip,则回退为 ` -m pip`。 - """ - try: - bin_dir = Path(python_path).resolve().parent - for name in ("pip3", "pip"): - cand = bin_dir / name - if cand.exists() and os.access(cand, os.X_OK): - return str(cand) - except Exception: - pass - return f"{python_path} -m pip" - def _detect_preinstalled_python(self) -> Optional[str]: """尝试定位预装虚拟环境的 python 可执行文件。""" # 允许显式指定可执行文件(优先级最高)