Airflow安装失败:google-re2与greenlet编译wheel出错求助
解决Airflow安装时clang编译google-re2等包失败的问题
不需要修改setup.py或bdist_wheel,问题根源是Mac系统的Command Line Tools环境配置异常,导致clang无法正常读取SDK路径或执行编译操作。以下是具体解决步骤:
1. 修复Command Line Tools
- 重新安装Command Line Tools:
xcode-select --install - 若已安装,重置工具路径:
sudo xcode-select --reset - 验证SDK目录是否存在:
若输出中无ls /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk,需升级Xcode到最新版本,或通过Xcode的Preferences > Locations确认SDK路径配置。
2. 手动指定SDK环境变量
- 临时生效:在执行pip安装前,先在终端运行:
export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk - 永久生效:根据你使用的shell配置文件(bash用
~/.bash_profile,zsh用~/.zshrc)添加上述export命令,然后执行:# zsh示例 source ~/.zshrc
3. 更新pip及构建工具
确保pip、setuptools、wheel为最新版本,避免旧版本导致的构建兼容问题:
pip3 install --upgrade pip setuptools wheel
4. 重新执行Airflow安装
完成上述配置后,重新运行Airflow的安装命令(替换为你使用的约束文件路径):
pip3 install apache-airflow --constraint <你的约束文件路径>
备选方案:使用预编译wheel包
若编译问题仍存在,可直接安装预编译的wheel包跳过本地编译:
pip3 install --only-binary :all: google-re2 pendulum greenlet
安装完成后再执行Airflow的安装命令。
内容的提问来源于stack exchange,提问作者FannieY
相关产品推荐
相关产品推荐

