chore(terminal): 删除无调用的 _derive_pip_from_python 死代码

This commit is contained in:
JOJO 2026-07-20 15:53:16 +08:00
parent cb877b4b67
commit ccdc101192

View File

@ -64,22 +64,6 @@ class PythonMixin:
return self._detect_system_python()
@staticmethod
def _derive_pip_from_python(python_path: str) -> str:
"""
根据 python 可执行文件推导匹配的 pip可避免python venvpip 却指向系统
若同目录下找不到 pip3/pip则回退为 `<python> -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 可执行文件。"""
# 允许显式指定可执行文件(优先级最高)