GeoDjango找不到地理图书馆

wmf*_*ox3 14 django postgresql macos geodjango

尝试启动django服务器时,出现以下错误:

django.core.exceptions.ImproperlyConfigured: Could not import user-defined GEOMETRY_BACKEND "geos".
Run Code Online (Sandbox Code Playgroud)

我在Mac OS Lion上运行postgresql8.4.

我用Macports来安装PostGIS.这是$ port安装显示的内容:

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版本时得到的结果:

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
Run Code Online (Sandbox Code Playgroud)

pan*_*ore 11

为了防止一些开发人员在Ubuntu上遇到这个问题,我解决了它只是安装了libgeos-lib

sudo apt-get install libgeos-dev


Mar*_*ano 6

虽然我可以select postgis_full_version();毫无问题地执行,但是我通过MacPorts与Django结合使用postgis也遇到了同样的问题.这个答案对我有所帮助:http://pragmaticstartup.wordpress.com/2012/09/30/django-core-exceptions-improperlyconfigured-could-not-import-user-defined-geometry_backend-geos/

我的解决方案是添加

export DYLD_FALLBACK_LIBRARY_PATH=$DYLD_FALLBACK_LIBRARY_PATH:/opt/local/lib/
Run Code Online (Sandbox Code Playgroud)

~/.profile.(在再次尝试之前不要忘记采购它)


Jay*_*ler 6

我发现我最初通过pip安装了geos.

我从以下网址下载了新的GEOS库:http: //www.kyngchaos.com/software/frameworks#geos

然后安装它.

最后,我添加到我的路径(〜/ .bash_profile):

export PATH=/Library/Frameworks/GEOS.framework/Versions/3/unix/lib/:$PATH
Run Code Online (Sandbox Code Playgroud)

它工作正常.


Ala*_*air 1

你安装了geos库吗?

它包含在使用 macports 安装 GeoDjango 的说明中。