python提供的一个第三方包Rtree包能够实现R树查询、删除、增添的各种操作。然而版主在windows环境 (win 10, python3.5)下安装Rtree包的时候出现了问题。直接在cmd中输入pip install Rtree后,会出现一下错误:
Collecting Rtree
Using cached Rtree-0.8.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\dellpc\AppData\Local\Temp\pip-build-zq00u5gn\Rtree\setup.py", line 4, in <module>
import rtree
File "C:\Users\dellpc\AppData\Local\Temp\pip-build-zq00u5gn\Rtree\rtree\__init__.py", line 1, in <module>
from .index import Rtree
File "C:\Users\dellpc\AppData\Local\Temp\pip-build-zq00u5gn\Rtree\rtree\index.py", line 6, in <module>
from . import core
File "C:\Users\dellpc\AppData\Local\Temp\pip-build-zq00u5gn\Rtree\rtree\core.py", line 101, in <module>
raise OSError("could not find or load spatialindex_c.dll")
OSError: could not find or load spatialindex_c.dll
如图所示:
当然,这个错误并不是版主没有使用pip3导致的,错误提示是少了spatialindex_c.dll这个文件。于是版主顺藤摸瓜,发现Rtree包是基于libspatialindex开发的,在安装Rtree之前必须先安装libspatialindex。关于libspatialindex,除了官网的英文外,这里有一个中文翻译过来的介绍:http://blog.csdn.net/ljz2173/article/details/46009573,不再多说。
于是版主又傻乎乎的去安装libspatialindex,但是开发这个libspatialindex的大神似乎并不喜欢windows,官网上只给了十分简要的安装说明,不过基本等于没说呀,大概意思是自己去找个编译器编译后使用吧。。。版主又借助在海外的优势,四处google怎样在windows下安装libspatialindex,找了半天全是国外网友的疑问,却没人回答......看来大部分人都是用的Linux,版主这么小白还用windows简直