1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Add double quotes for Windows python.exe paths if they contain space

This commit is contained in:
Billy Cao 2023-11-24 23:11:09 +08:00
parent 2a0acb595c
commit cd5c47eb63

View file

@ -628,7 +628,10 @@ def protect_pip_from_modification_on_windows(modifying_pip: bool) -> None:
) )
if should_show_use_python_msg: if should_show_use_python_msg:
new_command = [sys.executable, "-m", "pip"] + sys.argv[1:] sys_executable = sys.executable
if " " in sys_executable:
sys_executable = f'"{sys_executable}"'
new_command = [sys_executable, "-m", "pip"] + sys.argv[1:]
raise CommandError( raise CommandError(
"To modify pip, please run the following command:\n{}".format( "To modify pip, please run the following command:\n{}".format(
" ".join(new_command) " ".join(new_command)