This commit is contained in:
Billy Cao 2023-11-28 19:25:15 -05:00 committed by GitHub
commit ae1e5bdb8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

1
news/12411.feature.rst Normal file
View File

@ -0,0 +1 @@
Improve error message on Windows for upgrading pip in place

View File

@ -628,7 +628,10 @@ def protect_pip_from_modification_on_windows(modifying_pip: bool) -> None:
)
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(
"To modify pip, please run the following command:\n{}".format(
" ".join(new_command)