在macOS 13.0.1(Rosetta环境)下用pyenv安装Python3.7.3失败求助
在Rosetta运行的iTerm实例中安装Python 3.7.3失败
执行pyenv86 install 3.7.3时出现构建失败,错误提示:
BUILD FAILED (OS X 13.0.1 using python-build 20180424)
日志详情:
checking for clang++... no configure: By default, distutils will build C++ extension modules with "clang++". If this is not intended, then set CXX on the configure command line. checking for the platform triplet based on compiler characteristics... darwin configure: error: internal configure error for the platform triplet, please file a bug report make: *** No targets specified and no makefile found. Stop.
环境配置信息
- 当前终端架构:
$ arch i386
- brew86别名配置:
$ which brew86 brew86: aliased to arch --x86_64 /usr/local/Homebrew/bin/brew
- pyenv86别名配置:
$ which pyenv86 pyenv86: aliased to arch -x86_64 pyenv
- PATH环境变量:
$ echo $PATH /opt/homebrew/bin:/Users/abhinavmulagada/.pyenv/shims:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin
- ~/.zshrc配置内容:
# rosetta setup if [ $(arch) = "i386" ]; then alias brew86='arch --x86_64 /usr/local/Homebrew/bin/brew' alias pyenv86="arch -x86_64 pyenv" fi # pyenv if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)" fi path=('/opt/homebrew/bin' $path) export PATH
解决建议
- 手动指定clang++路径:从日志看系统无法找到clang++,安装时直接指定CXX环境变量指向系统默认的clang++:
CXX=/usr/bin/clang++ pyenv86 install 3.7.3 - 调整PATH优先级:当前PATH中ARM版Homebrew路径(/opt/homebrew/bin)排在X86版(/usr/local/bin)之前,可能导致依赖调用错误。修改~/.zshrc中的PATH配置:
执行path=('/usr/local/bin' '/opt/homebrew/bin' $path) export PATHsource ~/.zshrc使配置生效。 - 更新python-build组件:当前使用的python-build版本为20180424,版本过旧存在兼容性问题,通过X86版brew更新pyenv:
brew86 update && brew86 upgrade pyenv - 安装Xcode命令行工具(X86架构):确保Rosetta环境下有完整的编译工具:
安装完成后重启终端再尝试安装。arch -x86_64 xcode-select --install
内容的提问来源于stack exchange,提问作者abhinavkm
相关产品推荐
相关产品推荐

