PostgreSQL 12和PostGIS 3.0.1:错误:无法访问文件“$libdir/postgis-3”:Linux上没有此文件或目录。

14
我在我的Linux Mint 19.2上安装了最新的PostgreSQL 12,使用以下命令:sudo apt-get install postgresql。同样地,我也安装了最新的Postgis 3.0.1,使用以下命令:sudo apt-get install postgis
我设置了postgres账户并且一切都正常,我想要创建一个PostGIS的扩展。因此,我还需要安装postgresql-12-postgis-3-scripts,它会将postgis.control添加到PostgreSQL的安装中。
然后,我连接到我的postgres账户,创建并初始化了一个名为test的数据库,并尝试执行create extension postgis。然而,我收到了以下错误信息:ERROR: could not access file "$libdir/postgis-3": No such file or directory
无论是PostgreSQL还是PostGIS都是全新安装的。我的计算机上没有损坏的依赖项或旧的PostgreSQL残留文件...我错过了什么吗?
3个回答

17
你离成功很近了。尝试在你的 PostgreSQL 12 中安装 postgis,操作如下:
sudo apt-get install postgresql-12-postgis-3

之后,你将能够成功运行。
CREATE EXTENSION postgis;

2
太好了!我不知道postgresql-12-postgis-3的存在。我以为PostGIS安装时会自动创建捆绑包。谢谢! - janchytry

5

2
  • I tried the answer by @JimJones and it worked for me previously but when i got this error again i kept getting Package postgresql-12-postgis-3 is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'postgresql-12-postgis-3' has no installation candidate on trying same solution again.

  • What worked for me was installing gnupg2.

    • Steps
      sudo apt -y install gnupg2
      
      wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
      
      echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg 
      main" |sudo tee  /etc/apt/sources.list.d/pgdg.list
      
      sudo apt update
      
      sudo apt install postgis postgresql-12-postgis-3
      
    • source -> https://computingforgeeks.com/how-to-install-postgis-on-ubuntu-debian/

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接