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

Jas*_*son 7 python macos python-poetry

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

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 ~ % 
Run Code Online (Sandbox Code Playgroud)

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

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
Run Code Online (Sandbox Code Playgroud)

Python 版本 3.8.9:

u@s-MacBook-Pro ~ % python3 --version
Python 3.8.9
u@s-MacBook-Pro ~ %
Run Code Online (Sandbox Code Playgroud)

Xcode版本:

u@s-MacBook-Pro ~ % xcodebuild -version
Xcode 13.2.1
Build version 13C100
u@s-MacBook-Pro ~ %
Run Code Online (Sandbox Code Playgroud)

Jas*_*son 5

我通过安装非系统版本的 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 -

  • 可能还需要 shell 配置(`pyenv init`)来获取诗歌来发现安装。 (2认同)