poetry 在 macOS 11.6/Xcode 13 上安装失败:dyld:库未加载:@executable_path/../Python3

poetry install fails on macOS 11.6/Xcode 13: dyld: Library not loaded: @executable_path/../Python3

新诗在 macOS 11.6/Xcode13 上安装失败,使用官方安装程序:

u@s-MacBook-Pro ~ % curl -sSL https://install.python-poetry.org | python3 -
Retrieving Poetry metadata

# Welcome to Poetry!

This will download and install the latest version of Poetry,
a dependency and package manager for Python.

It will add the `poetry` command to Poetry's bin directory, located at:

/Users/u/Library/Python/3.8/bin

You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.

Installing Poetry (1.1.12): An error occurred. Removing partial environment.
Poetry installation failed.
See /Users/u/poetry-installer-error-h3v75uw9.log for error logs.
u@s-MacBook-Pro ~ % more /Users/u/poetry-installer-error-h3v75uw9.log
dyld: Library not loaded: @executable_path/../Python3
  Referenced from: /Users/u/Library/Application Support/pypoetry/venv/bin/python3
  Reason: image not found

Traceback:

  File "<stdin>", line 877, in main
  File "<stdin>", line 514, in run
u@s-MacBook-Pro ~ % 

缓存或应用程序支持中没有以前的诗歌安装或引用:

u@s-MacBook-Pro ~ % ls -al Library/Application\ Support/pypoetry
total 0
drwxr-xr-x   2 u  staff    64 26 Jan 16:58 .
drwx------+ 55 u  staff  1760 26 Jan 16:43 ..
u@s-MacBook-Pro ~ % ls -al Library/Caches/pypoetry
ls: Library/Caches/pypoetry: No such file or directory

Python 版本 3.8.9:

u@s-MacBook-Pro ~ % python3 --version
Python 3.8.9
u@s-MacBook-Pro ~ %

Xcode版本:

u@s-MacBook-Pro ~ % xcodebuild -version
Xcode 13.2.1
Build version 13C100
u@s-MacBook-Pro ~ %

我通过安装 non-system 版本的 python3,然后安装诗歌来解决这个问题。

  1. brew install pyenv
  2. pyenv install 3.8.12
  3. pyenv local 3.8.12
  4. curl -sSL https://install.python-poetry.org | python3 -