我在OS X Yosemite上安装Spatialite工具时遇到问题,首先我读过Install Spatialite for python (GeoDjango) on OS X但它并没有帮助我解决问题。
在这里,我将提供一些步骤,以便使用Homebrew安装spaceite。
1)安装最新的sqlite3
brew install sqlite
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.8.8.3.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/sqlite-3.8.8.3.yosemite.bottle.tar.gz
==> Pouring sqlite-3.8.8.3.yosemite.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.
OS X provides an older sqlite3.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/sqlite/lib
CPPFLAGS: -I/usr/local/opt/sqlite/include
==> Summary
/usr/local/Cellar/sqlite/3.8.8.3: 9 files, 2.1M
2)安装libspatialite
brew install libspatialite
==> Downloading https://homebrew.bintray.com/bottles/libspatialite-4.2.0_1.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/libspatialite-4.2.0_1.yosemite.bottle.tar.gz
==> Pouring libspatialite-4.2.0_1.yosemite.bottle.tar.gz
/usr/local/Cellar/libspatialite/4.2.0_1: 26 files, 17M
3)安装spatialite-tools
brew install spatialite-tools
==> Downloading https://homebrew.bintray.com/bottles/spatialite-tools-4.2.0.yosemite.bottle.3.tar.gz
Already downloaded: /Library/Caches/Homebrew/spatialite-tools-4.2.0.yosemite.bottle.3.tar.gz
==> Pouring spatialite-tools-4.2.0.yosemite.bottle.3.tar.gz
/usr/local/Cellar/spatialite-tools/4.2.0: 21 files, 804K
4)到目前为止看起来很好,让我们尝试使用spatialite
spatialite -version
SQLite header and source version mismatch
2015-02-25 13:29:11 9d6c1880fb75660bbabd693175579529785f8a6b
2014-12-09 01:34:36 f66f7a17b78ba617acde90fc810107f34f1a1f2e
所以它看起来像是在sqlite3之上构建的 (f66f7a17b78ba617acde90fc810107f34f1a1f2e) 但不是(9d6c1880fb75660bbabd693175579529785f8a6b)
当前版本3.8.8.3 9d6c1880fb75660bbabd693175579529785f8a6b
所需版本3.8.7.4 f66f7a17b78ba617acde90fc810107f34f1a1f2e
要解决此问题,我需要手动安装sqlite 3.8.7.4而不是3.8.8.3,这是自制的最新版本
6)删除当前安装的sqlite
brew remove sqlite
brew unlink sqlite
7)安装sqlite 3.8.7.4
从这里下载tarbal https://www.sqlite.org/src/info/f66f7a17b78ba617acde90fc810107f34f1a1f2e并解压内容
使用
安装./configure
sudo make clean
sudo make
sudo make install
8)尝试创建空间数据库
spatialite geo.db "SELECT InitSpatialMetaData();"
dyld: lazy symbol binding failed: Symbol not found: _sqlite3_rtree_geometry_callback
Referenced from: /usr/local/lib/libspatialite.7.dylib
Expected in: /usr/local/lib/libsqlite3.0.dylib
dyld: Symbol not found: _sqlite3_rtree_geometry_callback
Referenced from: /usr/local/lib/libspatialite.7.dylib
Expected in: /usr/local/lib/libsqlite3.0.dylib
Trace/BPT trap: 5
所以问题是它在库中找不到_sqlite3_rtree_geometry_callback ...
请指出我做错了什么或者是否有更好的方法在OS X上安装
感谢您的时间