You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MacOS Mojave下pip安装Apache Airflow 2.6.3时google-re2编译失败求助

解决MacOS Mojave下安装Airflow 2.6.3时google-re2编译失败的问题

环境信息

  • 系统:MacOS Mojave
  • Python版本:3.8.3
  • pip版本:23.2
  • 虚拟环境:py_env(已激活)

问题描述

执行Airflow安装命令:

pip install apache-airflow==2.6.3 --constraint "https://raw.githubusercontent.com/apache/airflow/constraints-2.6.3/constraints-3.8.txt"

先遇到pybind11缺失错误,手动安装pybind11后,出现google-re2编译失败,核心错误为:

alias declarations are a C11 extension [-Wc11-extensions]
fatal error: too many errors emitted, stopping now [-ferror-limit=]
error: command '/usr/bin/gcc' failed with exit code 1

解决方案

1. 强制指定C++11标准编译google-re2

直接通过环境变量指定编译器使用C++11标准,单独安装google-re2:

CXXFLAGS="-std=c++11" pip install google-re2

安装完成后,重新执行Airflow的安装命令即可。

2. 更新Xcode Command Line Tools

MacOS Mojave自带的编译工具版本较老,可能缺少必要的C++标准支持,更新工具:

# 安装或更新Xcode命令行工具
xcode-select --install
# 升级系统所有更新(可选)
softwareupdate --install -a

3. 使用conda安装依赖(替代方案)

如果编译仍然失败,用conda直接安装预编译的google-re2包:

conda install -c conda-forge google-re2

完成后继续执行Airflow安装命令。

问题原因

MacOS Mojave默认的gcc编译器对C11标准支持不完善,而google-re2的编译依赖C11特性,导致编译过程中触发大量语法错误。通过指定CXXFLAGS强制启用C++11标准,或使用预编译包可绕过编译环节解决问题。

内容的提问来源于stack exchange,提问作者Ryan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.16 00:42:29