我在我的 Macbook Pro M2 2022 Sonoma 14.6 上安装了 pyenv,它是很久以前从基于 Intel 的芯片迁移而来的。我能够通过 pyenv 安装并运行 python v3.10.13 没有问题,但是当我尝试安装 python 3.10.15 时,构建失败,我不明白为什么。我尝试过重新安装 Homebrew 和重新安装命令行工具,但问题仍然存在。有什么想法吗?
python -V
Python 3.10.13
pyenv install 3.10.15
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.10.15.tar.xz...
-> https://www.python.org/ftp/python/3.10.15/Python-3.10.15.tar.xz
Installing Python-3.10.15...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 14.6 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/4h/8h2hjqjx659_l93m2_2qbqbw0000gn/T/python-build.20250107151340.62026
Results logged to /var/folders/4h/8h2hjqjx659_l93m2_2qbqbw0000gn/T/python-build.20250107151340.62026.log
Last 10 log lines:
ld: warning: duplicate -rpath '/opt/homebrew/lib' ignored
ld: warning: duplicate -rpath '/Users/kalicious/.pyenv/versions/3.10.15/lib' ignored
ld: warning: duplicate -rpath '/opt/homebrew/lib' ignored
ld: warning: search path '/Users/kalicious/.pyenv/versions/3.10.15/lib' not found
ld: warning: search path '/Users/kalicious/.pyenv/versions/3.10.15/lib' not found
ld: warning: search path '/Users/kalicious/.pyenv/versions/3.10.15/lib' not found
/opt/local/bin/ranlib: object: libpython3.10.a(getbuildinfo.o) malformed object (unknown load command 1)
ar: internal ranlib command failed
make: *** [libpython3.10.a] Error 1
make: *** Waiting for unfinished jobs....
为了跟进这个问题,事实证明我的问题是我的机器上安装了旧的损坏版本的 MacPorts。删除 MacPorts 解决了我的问题。
请参阅此线程以获取更多信息: https://github.com/pyenv/pyenv/issues/3158