def run_pip_command(command: List[str], check: bool = True, capture_output=True) -> Tuple[bool, Optional[str]]:
    """Run a pip command and return the result."""
    print('\n', ' '.join(command),'\n')
    try:
        result = subprocess.run(
            command,
            capture_output=capture_output,
            text=True,
            check=check
        )
        return (result.returncode == 0), (result.stderr or result.stdout)
    except subprocess.CalledProcessError as e:
        return False, e.stderr
    except FileNotFoundError:
        return False, "pip or Python not found."
    except Exception as e:
        return False, f"Unexpected error: {e}"
Run a pip command and return the result.
winpython/wheelhouse.py