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

如何在PGadmin中安装HTTP扩展?执行CREATE EXTENSION时遇文件不存在错误

解决PostgreSQL 14安装http扩展时的文件找不到错误

问题原因

报错ERROR: could not open extension control file "/usr/share/postgresql/14/extension/http.control": No such file or directory说明系统层面还未安装http扩展的对应文件,PostgreSQL无法找到扩展的控制文件,所以不能通过CREATE EXTENSION直接启用。

解决步骤

1. 优先通过系统包管理器安装(最简单)

根据你的操作系统选择对应命令:

  • Debian/Ubuntu 系列
    # 安装PostgreSQL 14对应的http扩展包
    sudo apt-get update && sudo apt-get install postgresql-14-http
    # 重启PostgreSQL服务使生效
    sudo systemctl restart postgresql
    
  • RHEL/CentOS/Rocky 系列
    # 安装对应版本扩展
    sudo dnf install postgresql14-http
    # 重启服务
    sudo systemctl restart postgresql
    
  • macOS(Homebrew)
    brew install postgresql-http
    brew services restart postgresql
    

2. 源码编译安装(当包管理器无对应版本时)

如果系统包没有适配PostgreSQL 14的版本,手动编译安装:

  1. 安装依赖:
    # Debian/Ubuntu
    sudo apt-get install postgresql-server-dev-14 libcurl4-openssl-dev
    # RHEL/CentOS
    sudo dnf install postgresql14-devel libcurl-devel
    
  2. 克隆并编译源码:
    git clone https://github.com/pramsey/pgsql-http.git
    cd pgsql-http
    make USE_PGXS=1
    sudo make USE_PGXS=1 install
    
  3. 重启PostgreSQL服务。

3. 启用扩展

回到PGadmin,重新执行SQL命令:

CREATE EXTENSION http;

注意事项

  • 确保安装的扩展版本与PostgreSQL版本严格匹配(比如PostgreSQL 14对应postgresql-14-http)
  • 扩展依赖libcurl库,安装时需确保系统已安装libcurl的开发包,否则编译或包安装会失败

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.24 23:07:16