File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change
1
+ Show the correct path to the interpreter also when it's a symlink in a venv in the pip upgrade prompt.
Original file line number Diff line number Diff line change @@ -77,7 +77,10 @@ def get_best_invocation_for_this_python() -> str:
77
77
78
78
# Try to use the basename, if it's the first executable.
79
79
found_executable = shutil .which (exe_name )
80
- if found_executable and os .path .samefile (found_executable , exe ):
80
+ # Virtual environments often symlink to their parent Python binaries, but we don't
81
+ # want to treat the Python binaries as equivalent when the environment's Python is
82
+ # not on PATH (not activated). Thus, we don't follow symlinks.
83
+ if found_executable and os .path .samestat (os .lstat (found_executable ), os .lstat (exe )):
81
84
return exe_name
82
85
83
86
# Use the full executable name, because we couldn't find something simpler.
You can’t perform that action at this time.
0 commit comments