Postgis + 无法访问文件“$libdir/postgis-2.1”:没有此文件或目录

Postgis + 无法访问文件“$libdir/postgis-2.1”:没有此文件或目录

我正在运行 postgresql9.3 和 postgis2.1 ,它运行良好。当我使用以下命令安装 QGIS 时:

sudo apt-get update
sudo apt-get install qgis

安装 QGIS 后,postGis 无法正常工作。当我尝试执行空间查询时,它显示错误:

 could not access file "$libdir/postgis-2.1": No such file or directory

所以我卸载了 QGIS,但现在也出现了同样的错误。我搜索了很多相关内容,但找不到解决方案。请帮我解决这个问题。提前谢谢。

答案1

您可以重新安装 PostgreSQL 的 postgis 扩展,它对我有用:

sudo apt-get install postgresql-9.3-postgis-2.1

答案2

重新安装 postgis 可能会解决某些情况,但在 Postgis 更新到 2.2 后,我遇到了同样的错误。如果是这种情况,您还需要进入您选择的 SQL 编辑器运行:

alter extension postgis update to "2.2.0";

我认为这需要以用户身份运行postgres。(我倾向于通过 来执行此操作psql -d my_database -U postgres。)

相关内容