mirror of
https://github.com/astral-sh/uv.git
synced 2025-10-01 14:31:12 +00:00
Search for python3
in unix virtual environments (#3798)
This commit is contained in:
parent
73b6a80f23
commit
99b8633ce3
3 changed files with 15 additions and 4 deletions
|
@ -115,8 +115,19 @@ pub(crate) fn virtualenv_python_executable(venv: impl AsRef<Path>) -> PathBuf {
|
||||||
// If none of these exist, return the standard location
|
// If none of these exist, return the standard location
|
||||||
default_executable
|
default_executable
|
||||||
} else {
|
} else {
|
||||||
// Search for `python` in the `bin` directory.
|
// Check for both `python3` over `python`, preferring the more specific one
|
||||||
venv.join("bin").join("python")
|
let default_executable = venv.join("bin").join("python3");
|
||||||
|
if default_executable.exists() {
|
||||||
|
return default_executable;
|
||||||
|
}
|
||||||
|
|
||||||
|
let executable = venv.join("bin").join("python");
|
||||||
|
if executable.exists() {
|
||||||
|
return executable;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If none of these exist, return the standard location
|
||||||
|
default_executable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ fn missing_venv() -> Result<()> {
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
warning: Requirements file requirements.in does not contain any dependencies
|
warning: Requirements file requirements.in does not contain any dependencies
|
||||||
error: failed to canonicalize path `[VENV]/bin/python`
|
error: failed to canonicalize path `[VENV]/bin/python3`
|
||||||
Caused by: No such file or directory (os error 2)
|
Caused by: No such file or directory (os error 2)
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
|
|
|
@ -119,7 +119,7 @@ fn missing_venv() -> Result<()> {
|
||||||
----- stdout -----
|
----- stdout -----
|
||||||
|
|
||||||
----- stderr -----
|
----- stderr -----
|
||||||
error: failed to canonicalize path `[VENV]/bin/python`
|
error: failed to canonicalize path `[VENV]/bin/python3`
|
||||||
Caused by: No such file or directory (os error 2)
|
Caused by: No such file or directory (os error 2)
|
||||||
"###);
|
"###);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue