diff --git a/src/pipx/util.py b/src/pipx/util.py index e10dac9433..ab80dc2227 100644 --- a/src/pipx/util.py +++ b/src/pipx/util.py @@ -55,7 +55,10 @@ def rmdir(path: Path, safe_rm: bool = True) -> None: logger.info(f"removing directory {path}") try: if WINDOWS: - os.system(f'rmdir /S /Q "{str(path)}"') + # The packaged app (Microsoft Store) version of Python uses path + # redirections, but `rmdir` won't follow these, so use realpath() + # to manually apply the redirection first. + os.system(f'rmdir /S /Q "{os.path.realpath(path)}"') else: shutil.rmtree(path) except FileNotFoundError: