postgresql CREATE EXTENSION postgis失败,

ttisahbt  于 2023-10-18  发布在  PostgreSQL
关注(0)|答案(9)|浏览(319)

我在Ubuntu 18.04上与psql (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.
qgzx9mmu

qgzx9mmu1#

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

2lpgd968

2lpgd9682#

我不确定我需要什么版本的postgres或postgis,所以我发现sudo apt install postgis postgresql-postgis工作。
它要么给了我最新的,要么匹配我安装的postgres版本。

zengzsys

zengzsys3#

我使用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;成功返回。

44u64gxh

44u64gxh4#

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

ejk8hzay

ejk8hzay5#

1.转到安装postgis的文件位置;
C:\Program Files\PostgreSQL\12\bin
1.运行stackbuilder.exe;
1.选择已连接的数据库;
1.选择“空间扩展”并安装

zpqajqem

zpqajqem6#

或者,更简单的方法是,为postgres12运行sudo apt install postgis postgresql-12-postgis-2.5

kb5ga3dv

kb5ga3dv7#

如果CREATE EXTENSION postgis不工作,并给你错误没有这样的文件或目录。然后按照以下步骤:
转到安装postgis的文件位置;
1.C:\Program Files\PostgreSQL\12\bin 2.运行stackbuilder.exe; 3.选择已连接的数据库; 4.选择“空间扩展”并安装
如果你是stackbuilder是不响应等待一段时间尝试与快速互联网连接.

uajslkp6

uajslkp68#

对于PostgreSQL 14:sudo apt install postgis postgresql-14-postgis-3在Ubuntu 20.04上测试

xxhby3vn

xxhby3vn9#

对于RedHat/CentOs/Fedora,此问题可以通过以下方式解决:
yum install postgresql13-contrib
参考:https://github.com/hapostgres/pg_auto_failover/issues/558

相关问题