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

Ubuntu22.04安装Apache Airflow遇HTTPSConnectionPool超时错误求助

解决Ubuntu 22.04安装Apache Airflow时raw.githubusercontent.com连接超时问题

核心原因

连接超时是因为网络无法正常访问raw.githubusercontent.com,大概率是网络限制导致的,和pip版本无关(你已经升级过pip,排除版本问题)。

可行解决方案

1. 手动绑定域名IP到hosts

  • 执行命令获取raw.githubusercontent.com的有效IP:
curl -s https://ipaddress.com/website/raw.githubusercontent.com | grep -oE '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' | head -1
  • 编辑系统hosts文件:
sudo nano /etc/hosts
  • 在文件末尾添加一行(替换成上面得到的IP):
185.199.108.133 raw.githubusercontent.com
  • 保存后重启DNS服务:
sudo systemctl restart systemd-resolved

之后重新执行Airflow安装命令。

2. 用国内PyPI镜像+本地约束文件安装

  • 先把Airflow的约束文件下载到本地(如果直接wget超时,就用浏览器打开链接复制内容新建文件):
wget https://raw.githubusercontent.com/apache/airflow/constraints-2.7.1/constraints-3.10.txt
  • 改用国内镜像源安装,指定本地约束文件:
pip install apache-airflow==2.7.1 -i https://pypi.tuna.tsinghua.edu.cn/simple --constraint ./constraints-3.10.txt

3. 配置代理(如果环境有可用代理)

  • 临时用代理安装:
pip install apache-airflow==2.7.1 --proxy http://代理IP:端口
  • 永久配置pip代理:
mkdir -p ~/.pip && nano ~/.pip/pip.conf

添加以下内容(替换成你的代理信息):

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
proxy = http://代理IP:端口

保存后重新安装即可。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.08 17:07:21