From 56e85d0ff72f6eb0344f6518802baf2e183495f8 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sat, 8 Aug 2020 16:24:24 +0100 Subject: [PATCH] Fix uninstallation of user scripts User scripts are installed to ~/.local/bin. pip was looking for scripts to uninstall in ~/.local/lib/python3.8/site-packages/bin. This commit makes it look in ~/.local/bin instead. --- news/8733.bugfix | 1 + src/pip/_internal/locations.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 news/8733.bugfix diff --git a/news/8733.bugfix b/news/8733.bugfix new file mode 100644 index 00000000000..94206119c21 --- /dev/null +++ b/news/8733.bugfix @@ -0,0 +1 @@ +Correctly uninstall console scripts installed to ~/.local/bin \ No newline at end of file diff --git a/src/pip/_internal/locations.py b/src/pip/_internal/locations.py index 0c1235488d6..a5ce599f76c 100644 --- a/src/pip/_internal/locations.py +++ b/src/pip/_internal/locations.py @@ -72,8 +72,10 @@ def get_src_prefix(): # Use getusersitepackages if this is present, as it ensures that the # value is initialised properly. user_site = site.getusersitepackages() + user_base = site.getuserbase() except AttributeError: user_site = site.USER_SITE + user_base = site.USER_BASE if WINDOWS: bin_py = os.path.join(sys.prefix, 'Scripts') @@ -84,7 +86,7 @@ def get_src_prefix(): bin_user = os.path.join(user_site, 'bin') else: bin_py = os.path.join(sys.prefix, 'bin') - bin_user = os.path.join(user_site, 'bin') + bin_user = os.path.join(user_base, 'bin') # Forcing to use /usr/local/bin for standard macOS framework installs # Also log to ~/Library/Logs/ for use with the Console.app log viewer