【问题标题】:GeoDjango setup: ERROR: could not access file "$libdir/postgis-1.5": No such file or directoryGeoDjango 设置:错误:无法访问文件“$libdir/postgis-1.5”:没有这样的文件或目录
【发布时间】:2011-03-23 17:01:24
【问题描述】:

更新:我以为我已经解决了,但我没有……请看下文。


我正在 Mac OSX 上安装 GeoDjango。我关注了Mac install instructions,一切顺利,现在是creating a spatial database template for PostGIS。

但是,当我尝试加载 PostGIS SQL 例程时,我得到ERROR: could not access file "$libdir/postgis-1.5": No such file or directory:

postgres$ psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql
psql:/usr/local/pgsql/share/contrib/postgis-1.5/postgis.sql:59: ERROR:  could not access file "$libdir/postgis-1.5": No such file or directory
<snip>
psql:/usr/local/pgsql/share/contrib/postgis-1.5/postgis.sql:7785: ERROR:  type "geometry" does not exist

出了什么问题,我该如何解决?

我找到了these instructions from postgis IRC,但我认为我正在运行正确版本的 pg_config 等:

postgres$ which pg_config
/usr/local/pgsql/bin//pg_config
postgres$ which psql
/usr/local/pgsql/bin//psql
postgres$ pg_config --pkglibdir
/usr/local/pgsql/lib

我从KyngChaos 安装了 postgres 及其 PostGIS 扩展。如果我查看/usr/local/pgsql/lib,那里有一个名为postgis-1.5.so 的文件,所以我不明白为什么找不到它。

【问题讨论】:

  • 这很可能不是整个错误消息 - 在“错误:当前事务已中止,...”之前应该有一些内容。
  • 是的,有,抱歉。第一个错误是:psql:/usr/local/pgsql/share/contrib/postgis-1.5/postgis.sql:59: ERROR: could not access file "$libdir/postgis-1.5": No such file or directory (I '已经更新了问题以显示这一点)。
  • 您可以在专用站点gis.stackexchange.com找到更多有关GIS相关问题的专家解答

标签: postgresql geocoding postgis geodjango


【解决方案1】:

文件 /usr/local/Cellar/postgresql9/9.0.17/lib/postgis-1.5.so 丢失。 brew升级后出现此错误,解决方法是卸载postgis并重新安装:

brew 卸载 postgis15

brew 安装 postgis15

结果应该是:PostGIS 插件库安装到:/usr/local/Cellar/postgresql9/9.0.17/lib

所以之后你应该找到文件 /usr/local/Cellar/postgresql9/9.0.17/lib/postgis-1.5.so

【讨论】:

    【解决方案2】:

    我知道这是一个老问题,但我使用 Google 找到了它,所以其他人也可能会在这里结束。

    在我的 Mac OSX macports 安装中,我有两个文件夹,其中包含用于 postgresql 的 .so 文件:

    /opt/local/lib/postgresql90/
    

    和

    /usr/local/pgsql-9.0/lib/
    

    似乎我的安装在 /opt/local/lib/postgresql90/ 中而不是 /usr/local/pgsql-9.0/lib/ 中,所以要安装 pg_trgm,我必须执行以下操作:

    sudo ln -s /opt/local/lib/postgresql90/pg_trgm.so /usr/local/pgsql-9.0/lib/
    

    这应该适用于任何不在正确位置的 .so 文件 - 在您的示例中应该是

    sudo ln -s /opt/local/lib/postgresql90/postgis-1.5.so /usr/local/pgsql-9.0/lib/
    

    这也允许我安装 postgis :)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-26
      • 2014-01-16
      • 2021-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多