【问题标题】:CREATE EXTENSION postgis fails,创建扩展 postgis 失败,
【发布时间】:2020-07-24 05:24:30
【问题描述】:

我在Ubuntu 18.04psql (PostgreSQL) 12.2 (Ubuntu 12.2-2.pgdg18.04+1)

运行 temba=# create extension postgis; 失败并出现以下错误

ERROR:  could not open extension control file "/usr/share/postgresql/10/extension/postgis.control": No such file or directory

我运行find /usr -name postgis.control 却发现postgis.control 位于名为12 而不是10 的文件夹中

laptop@xyz-x:~$ find /usr -name postgis.control
/usr/share/postgresql/12/extension/postgis.control

编辑 1

我已经跑过sudo apt-get install postgis

Reading package lists... Done
Building dependency tree       
Reading state information... Done
postgis is already the newest version (3.0.1+dfsg-2.pgdg18.04+1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

【问题讨论】:

    标签: postgresql postgis


    【解决方案1】:

    我运行了这个sudo apt install postgis postgresql-10-postgis-2.5,它成功了

    【讨论】:

    • 从 19.10 开始的 Ubuntu 软件数据库是 Postgres v10。这就是您将 apt-get 创建到文件夹 /10/ 而不是 /12/ 的原因。 Ubuntu 20.04 应该与 Postgres v12 一起使用。但是 Postgis 2.5 (至少应该)与 Postgres 10 和 12 兼容。所以也许只需将 /10/ 复制到 /12/ 任何重试以创建扩展。
    【解决方案2】:

    我不确定我需要什么版本的 postgres 或 postgis,所以我发现 sudo apt install postgis postgresql-postgis 有效。

    它要么给了我最新的,要么与我安装的 postgres 版本相匹配。


    【讨论】:

      【解决方案3】:

      我使用 Linux Mint 并在 postgres10 上遇到了这个问题,并且:could not access file "$libdir/postgis-2.4": No such file or directory 紧随其后。安装特定的扩展脚本包为我解决了这个问题:

      sudo apt install postgresql-10-postgis-2.4 postgresql-10-postgis-2.4-scripts Reading package lists... Done Building dependency tree Reading state information... Done postgresql-10-postgis-2.4-scripts is already the newest version (2.4.3+dfsg-4). postgresql-10-postgis-2.4-scripts set to manually installed. The following NEW packages will be installed libprotobuf-c1 postgresql-10-postgis-2.4

      然后转到 pgAdmin,CREATE EXTENSION postgis; 成功返回。

      【讨论】:

      • 有趣的是 Synaptic 说脚本可以安全删除。显然它仍然有用。
      【解决方案4】:

      sudo apt install postgis postgresql-13-postgis-3 用于 postgres 13.1 和下一个 CREATE EXTENSION postgis;(postgres 命令)

      【讨论】:

        【解决方案5】:

        对于 postgres12,运行 sudo apt install postgis postgresql-12-postgis-2.5 也更简单

        【讨论】:

          【解决方案6】:
          1. 转到安装postgis的文件位置;

            C:\Program Files\PostgreSQL\12\bin

          2. 运行stackbuilder.exe;

          3. 选择连接你的数据库;

          4. 选择“空间扩展”并安装

          【讨论】:

            猜你喜欢
            • 2018-02-27
            • 2013-08-08
            • 1970-01-01
            • 1970-01-01
            • 2017-08-26
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2015-02-17
            相关资源
            最近更新 更多