From 8278b0daf1b53397babaccf96c245195163bf5fa Mon Sep 17 00:00:00 2001 From: caorantaoyao Date: Tue, 11 Aug 2026 04:35:22 +0800 Subject: [PATCH 1/2] fix: issue #24 --- install-poetry.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/install-poetry.py b/install-poetry.py index 29ad14c..cd9f9bf 100644 --- a/install-poetry.py +++ b/install-poetry.py @@ -327,6 +327,14 @@ def make(cls, target: Path) -> "VirtualEnvironment": import ensurepip # noqa: F401 import venv + if sys.platform == "darwin" and "/Library/Developer/CommandLineTools" in (sys.executable or ""): + # The macOS Xcode Command Line Tools Python is a stub (e.g. /usr/bin/python3 -> + # /Library/Developer/CommandLineTools/usr/bin/python3) whose venv bin/python + # carries an unresolvable `@executable_path/../Python3` loader reference, so + # pip (and therefore the poetry install) fails with a dyld error. Use the + # robust virtualenv bootstrap (--always-copy) below to create a self-contained venv. + raise ImportError + builder = venv.EnvBuilder(clear=True, with_pip=True, symlinks=False) context = builder.ensure_directories(target) @@ -339,7 +347,9 @@ def make(cls, target: Path) -> "VirtualEnvironment": builder.create(target) except ImportError: - # fallback to using virtualenv package if venv is not available, eg: ubuntu + # fallback to using virtualenv package if venv is not available (eg: ubuntu) + # or if the base interpreter is the macOS Command Line Tools stub which + # produces a broken venv python_version = f"{sys.version_info.major}.{sys.version_info.minor}" virtualenv_bootstrap_url = ( f"https://bootstrap.pypa.io/virtualenv/{python_version}/virtualenv.pyz" From 40377d49ad0680d1c9e598ff399f06038f1ba733 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Aug 2026 20:35:57 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- install-poetry.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/install-poetry.py b/install-poetry.py index cd9f9bf..5c9ef47 100644 --- a/install-poetry.py +++ b/install-poetry.py @@ -327,7 +327,9 @@ def make(cls, target: Path) -> "VirtualEnvironment": import ensurepip # noqa: F401 import venv - if sys.platform == "darwin" and "/Library/Developer/CommandLineTools" in (sys.executable or ""): + if sys.platform == "darwin" and "/Library/Developer/CommandLineTools" in ( + sys.executable or "" + ): # The macOS Xcode Command Line Tools Python is a stub (e.g. /usr/bin/python3 -> # /Library/Developer/CommandLineTools/usr/bin/python3) whose venv bin/python # carries an unresolvable `@executable_path/../Python3` loader reference, so