无法在macOS上安装libspatilite

时间:2018-02-07 13:16:19

标签: spatialite

我试图在macOS上安装spatialite来查询带有geocordinates的sqlite数据库。

有一个brew公式可以提供lib和工具

brew install libspatialite
brew install spatialite-tools

我安装了那些但是当我尝试加载库时出现了这个错误:

spatialite test.db  'SELECT load_extension("mod_spatialite")'
SpatiaLite version ..: 4.3.0a   Supported Extensions:
    - 'VirtualShape'    [direct Shapefile access]
    - 'VirtualDbf'      [direct DBF access]
    - 'VirtualXL'       [direct XLS access]
    - 'VirtualText'     [direct CSV/TXT access]
    - 'VirtualNetwork'  [Dijkstra shortest path]
    - 'RTree'       [Spatial Index - R*Tree]
    - 'MbrCache'        [Spatial Index - MBR cache]
    - 'VirtualSpatialIndex' [R*Tree metahandler]
    - 'VirtualElementary'   [ElemGeoms metahandler]
    - 'VirtualXPath'    [XML Path Language - XPath]
    - 'VirtualFDO'      [FDO-OGR interoperability]
    - 'VirtualGPKG' [OGC GeoPackage interoperability]
    - 'VirtualBBox'     [BoundingBox tables]
    - 'SpatiaLite'      [Spatial SQL - OGC]
PROJ.4 version ......: Rel. 4.9.3, 15 August 2016
GEOS version ........: 3.6.2-CAPI-1.10.2 4d2925d6
LWGEOM version ......: 2.1.5
TARGET CPU ..........: x86_64-apple-darwin17.0.0
Error: dlopen(mod_spatialite, 10): image not found

我确实在我以前的Mac上安装了它,它工作得很好。

brew doctor看起来还不错:

brew doctor
Your system is ready to brew.

动态库存在:

brew list libspatialite
/usr/local/Cellar/libspatialite/4.3.0a_3/include/spatialite/ (19 files)
/usr/local/Cellar/libspatialite/4.3.0a_3/include/spatialite.h
/usr/local/Cellar/libspatialite/4.3.0a_3/lib/libspatialite.7.dylib
/usr/local/Cellar/libspatialite/4.3.0a_3/lib/mod_spatialite.7.dylib
/usr/local/Cellar/libspatialite/4.3.0a_3/lib/pkgconfig/spatialite.pc
/usr/local/Cellar/libspatialite/4.3.0a_3/lib/ (3 other files)

1 个答案:

答案 0 :(得分:0)

尝试在SQL中为模块指定完整的文件名:

SELECT load_extension("mod_spatialite.dylib")

SELECT load_extension("mod_spatialite.7.dylib")