Skip to content

Commit 2781416

Browse files
committed
Check if binary_executable exists
1 parent b8ccb04 commit 2781416

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/pip/_internal/utils/entrypoints.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,14 @@ def get_best_invocation_for_this_pip() -> str:
5555
if exe_are_in_PATH:
5656
for exe_name in _EXECUTABLE_NAMES:
5757
found_executable = shutil.which(exe_name)
58-
if found_executable and os.path.samefile(
59-
found_executable,
60-
os.path.join(binary_prefix, exe_name),
58+
binary_executable = os.path.join(binary_prefix, exe_name)
59+
if (
60+
found_executable
61+
and os.path.exists(binary_executable)
62+
and os.path.samefile(
63+
found_executable,
64+
binary_executable,
65+
)
6166
):
6267
return exe_name
6368

0 commit comments

Comments
 (0)