Skip to content

Commit 4e53eaf

Browse files
committed
Use python -m pip for the upgrade prompt on Windows
1 parent 26d8441 commit 4e53eaf

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/pip/_internal/self_outdated_check.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
from pip._internal.metadata.base import DistributionVersion
2121
from pip._internal.models.selection_prefs import SelectionPreferences
2222
from pip._internal.network.session import PipSession
23-
from pip._internal.utils.entrypoints import get_best_invocation_for_this_pip
23+
from pip._internal.utils.compat import WINDOWS
24+
from pip._internal.utils.entrypoints import (
25+
get_best_invocation_for_this_pip,
26+
get_best_invocation_for_this_python,
27+
)
2428
from pip._internal.utils.filesystem import adjacent_tmp_file, check_path_owner, replace
2529
from pip._internal.utils.misc import ensure_dir
2630

@@ -120,7 +124,10 @@ class UpgradePrompt:
120124
new: str
121125

122126
def __rich__(self) -> Group:
123-
pip_cmd = get_best_invocation_for_this_pip()
127+
if WINDOWS:
128+
pip_cmd = f"{get_best_invocation_for_this_python()} -m pip"
129+
else:
130+
pip_cmd = get_best_invocation_for_this_pip()
124131

125132
notice = "[bold][[reset][blue]notice[reset][bold]][reset]"
126133
return Group(

0 commit comments

Comments
 (0)