From 4706198b2d5f67b3a8cf32c19efbaa7f57f358dd Mon Sep 17 00:00:00 2001 From: cielavenir Date: Sun, 26 Oct 2025 22:06:26 +0900 Subject: [PATCH 1/2] Patch scheme to posix_prefix if posix_local and --prefix is specified --- src/pip/_internal/locations/_sysconfig.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pip/_internal/locations/_sysconfig.py b/src/pip/_internal/locations/_sysconfig.py index d4a448ece52..f44058bda89 100644 --- a/src/pip/_internal/locations/_sysconfig.py +++ b/src/pip/_internal/locations/_sysconfig.py @@ -155,6 +155,12 @@ def get_scheme( else: scheme_name = _infer_prefix() + # Special case: When installing into a custom prefix, use posix_prefix + # instead of posix_local because it should be used only to redirecting + # to /usr/local. + if prefix is not None and scheme_name == "posix_local": + scheme_name = "posix_prefix" + # Special case: When installing into a custom prefix, use posix_prefix # instead of osx_framework_library. See _should_use_osx_framework_prefix() # docstring for details. From f896867fd53093efb9be0afca4fa0920619379fd Mon Sep 17 00:00:00 2001 From: cielavenir Date: Sun, 26 Oct 2025 22:15:21 +0900 Subject: [PATCH 2/2] Add news --- news/13634.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/13634.bugfix.rst diff --git a/news/13634.bugfix.rst b/news/13634.bugfix.rst new file mode 100644 index 00000000000..8df20c49d05 --- /dev/null +++ b/news/13634.bugfix.rst @@ -0,0 +1 @@ +Patch scheme to posix_prefix if posix_local and --prefix is specified