postgresql GeoDjango 找不到 geos 库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8290167/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
GeoDjango can't find geos library
提问by wmfox3
When attempting to fire up the django server, I get the following error:
尝试启动 django 服务器时,出现以下错误:
django.core.exceptions.ImproperlyConfigured: Could not import user-defined GEOMETRY_BACKEND "geos".
I'm running postgresql8.4 on Mac OS Lion.
我在 Mac OS Lion 上运行 postgresql8.4。
I've used Macports to install PostGIS. Here's what $ port installed shows:
我已经使用 Macports 来安装 PostGIS。以下是 $ port installed 显示的内容:
postgis @1.5.2_1+postgresql84 postgis @1.5.2_1+postgresql90 postgis @1.5.3_0+postgresql90 postgis @1.5.3_0+postgresql91 (active)
postgis @1.5.2_1+postgresql84 postgis @1.5.2_1+postgresql90 postgis @1.5.3_0+postgresql90 postgis @1.5.3_0+postgresql91(活动)
Here's what I get when attempting to determine what version of PostGIS I've got:
这是我在尝试确定我拥有的 PostGIS 版本时得到的信息:
geodjango=# SELECT PostGIS_full_version();
ERROR: could not access file "$libdir/postgis-1.5": No such file or directory
CONTEXT: SQL statement "SELECT postgis_lib_version()"
PL/pgSQL function "postgis_full_version" line 11 at SQL statement
回答by panchicore
Just in case some developers are facing this problem on Ubuntu, I solved it just installing libgeos-lib
以防万一一些开发人员在 Ubuntu 上遇到这个问题,我只安装了 libgeos-lib 就解决了
sudo apt-get install libgeos-dev
sudo apt-get install libgeos-dev
回答by Martijn de Milliano
I had the same problem with postgis via MacPorts in combination with Django, although I could execute select postgis_full_version();
without issues. This answer helped me: http://pragmaticstartup.wordpress.com/2012/09/30/django-core-exceptions-improperlyconfigured-could-not-import-user-defined-geometry_backend-geos/
我通过 MacPorts 与 Django 结合使用 postgis 遇到了同样的问题,尽管我可以select postgis_full_version();
毫无问题地执行。这个答案帮助了我:http: //pragmaticstartup.wordpress.com/2012/09/30/django-core-exceptions-improperlyconfigured-could-not-import-user-defined-geometry_backend-geos/
The solution for me was to add
我的解决方案是添加
export DYLD_FALLBACK_LIBRARY_PATH=$DYLD_FALLBACK_LIBRARY_PATH:/opt/local/lib/
to ~/.profile
. (Don't forget to source it before trying again)
到~/.profile
。(在再次尝试之前不要忘记获取它的来源)
回答by JayCrossler
I found that I'd originally installed geos through pip.
我发现我最初是通过 pip 安装 geos 的。
Once I downloaded the new GEOS library from: http://www.kyngchaos.com/software/frameworks#geos
一旦我从以下位置下载了新的 GEOS 库:http: //www.kyngchaos.com/software/frameworks#geos
Then installed it.
然后安装了它。
Last, I added to my path (~/.bash_profile):
最后,我添加到我的路径 (~/.bash_profile):
export PATH=/Library/Frameworks/GEOS.framework/Versions/3/unix/lib/:$PATH
It worked fine.
它工作得很好。
回答by Alasdair
Have you installed the geoslibrary?
您是否安装了geos库?
It's included in the instructions for installing GeoDjango with macports.