mirror of
				https://github.com/astral-sh/uv.git
				synced 2025-10-29 19:17:26 +00:00 
			
		
		
		
	Include base installation directory in uv run PATH (#9585)
## Summary On Windows, non-virtual environments put the `python.exe` in the top-level of the installation directory, rather than in `Scripts`. This PR adds those paths to `PATH` in `uv run` and `uv tool run`. Closes https://github.com/astral-sh/uv/issues/9574#issuecomment-2512217110.
This commit is contained in:
		
							parent
							
								
									c3904a65c4
								
							
						
					
					
						commit
						02c105c3cb
					
				
					 1 changed files with 9 additions and 0 deletions
				
			
		|  | @ -1017,6 +1017,15 @@ pub(crate) async fn run( | |||
|             .map(PythonEnvironment::scripts) | ||||
|             .into_iter() | ||||
|             .chain(std::iter::once(base_interpreter.scripts())) | ||||
|             .chain( | ||||
|                 // On Windows, non-virtual Python distributions put `python.exe` in the top-level
 | ||||
|                 // directory, rather than in the `Scripts` subdirectory.
 | ||||
|                 cfg!(windows) | ||||
|                     .then(|| base_interpreter.sys_executable().parent()) | ||||
|                     .flatten() | ||||
|                     .into_iter(), | ||||
|             ) | ||||
|             .dedup() | ||||
|             .map(PathBuf::from) | ||||
|             .chain( | ||||
|                 std::env::var_os(EnvVars::PATH) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Charlie Marsh
						Charlie Marsh