GeoDjango 设置:错误:无法访问文件“$libdir/postgis-1.5”:没有这样的文件或目录

发布于 2024-09-12 15:50:32 字数 1381 浏览 6 评论 0原文

更新:以为我已经解决了它,但我没有......请参见下文。


我正在 Mac OSX 上安装 GeoDjango。我已按照 Mac 安装说明,一切都很顺利,现在为 PostGIS 创建空间数据库模板

但是,当我尝试加载 PostGIS SQL 例程时,出现错误:无法访问文件“$libdir/postgis-1.5”:没有这样的文件或目录:

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

出了什么问题,我该怎么办修复它吗?

我发现这些来自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 的文件,所以我不明白为什么没有找到它。

Update: thought I'd solved it, but I hadn't... please see below.


I'm installing GeoDjango on Mac OSX. I've followed the Mac install instructions, which all went smoothly, and am now creating a spatial database template for PostGIS.

However, when I try to load the PostGIS SQL routines, I get 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

What's going wrong, and how can I fix it?

I found these instructions from postgis IRC, but I think I'm running the right version of pg_config, etc:

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

I installed postgres and its PostGIS extensions from KyngChaos. If I look in /usr/local/pgsql/lib, there is a file called postgis-1.5.so there, so I don't understand why it's not being found.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

粉红×色少女 2024-09-19 15:50:32

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

在我的 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 :)

I know this an old question, but i found it using Google, so others might end up here as well.

On my Mac OSX macports install, i had two folders with .so files for postgresql:

/opt/local/lib/postgresql90/

and

/usr/local/pgsql-9.0/lib/

It seems like my installation looked in /opt/local/lib/postgresql90/ and not in /usr/local/pgsql-9.0/lib/, so to install pg_trgm, i had to do the following:

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

This should work with any .so file which is not in the right place - In your example it would have been

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

Which allows me to install postgis as well :)

高冷爸爸 2024-09-19 15:50:32

文件 /usr/local/Cellar/postgresql9/9.0.17/lib/postgis-1.5.so 丢失。这个错误发生在brew升级之后,解决方案是卸载postgis并重新安装它:

brew uninstall postgis15brew

install postgis15

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

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

The file /usr/local/Cellar/postgresql9/9.0.17/lib/postgis-1.5.so is missing. This error happened after brew upgrade and the solution is to uninstall postgis and reinstall it with:

brew uninstall postgis15

brew install postgis15

The result should be: PostGIS plugin libraries installed to: /usr/local/Cellar/postgresql9/9.0.17/lib

So afterwards you should find the file /usr/local/Cellar/postgresql9/9.0.17/lib/postgis-1.5.so

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文