Skip to content

Commit

Permalink
Update src/pip/_internal/utils/entrypoints.py
Browse files Browse the repository at this point in the history
Co-authored-by: Richard Si <sichard26@gmail.com>
  • Loading branch information
roubert and ichard26 authored Jan 30, 2025
1 parent d989254 commit d4ae219
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/pip/_internal/utils/entrypoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ def get_best_invocation_for_this_python() -> str:

# Try to use the basename, if it's the first executable.
found_executable = shutil.which(exe_name)
# Virtual environments often symlink to their parent Python binaries, but we don't
# want to treat the Python binaries as equivalent when the environment's Python is
# not on PATH (not activated). Thus, we don't follow symlinks.
if found_executable and os.path.samestat(os.lstat(found_executable), os.lstat(exe)):
return exe_name

Expand Down

0 comments on commit d4ae219

Please sign in to comment.