diff --git a/news/13429.bugfix.rst b/news/13429.bugfix.rst new file mode 100644 index 00000000000..3da7100817d --- /dev/null +++ b/news/13429.bugfix.rst @@ -0,0 +1 @@ +Use consistent ``python -m pip`` syntax across all platforms for upgrade recommendations instead of platform-specific commands. diff --git a/src/pip/_internal/self_outdated_check.py b/src/pip/_internal/self_outdated_check.py index ca507f113a4..5be37ab2858 100644 --- a/src/pip/_internal/self_outdated_check.py +++ b/src/pip/_internal/self_outdated_check.py @@ -22,9 +22,7 @@ from pip._internal.metadata import get_default_environment from pip._internal.models.selection_prefs import SelectionPreferences from pip._internal.network.session import PipSession -from pip._internal.utils.compat import WINDOWS from pip._internal.utils.entrypoints import ( - get_best_invocation_for_this_pip, get_best_invocation_for_this_python, ) from pip._internal.utils.filesystem import adjacent_tmp_file, check_path_owner, replace @@ -136,10 +134,9 @@ class UpgradePrompt: new: str def __rich__(self) -> Group: - if WINDOWS: - pip_cmd = f"{get_best_invocation_for_this_python()} -m pip" - else: - pip_cmd = get_best_invocation_for_this_pip() + # Use consistent module-based invocation across all platforms + # This is more reliable than direct pip commands + pip_cmd = f"{get_best_invocation_for_this_python()} -m pip" notice = "[bold][[reset][blue]notice[reset][bold]][reset]" return Group(