在Windows 64位上安装rtree


12

我正在使用Windows10 64位,我的os.name是'nt',我使用pip进行安装,但是它抱怨spaceindex_c.dll

 File "C:\Users\Bachir\AppData\Local\Temp\pip-build-td64lrth\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

我下载了rtree-0.8.2,然后运行python setup.py install,我有相同的消息

PS C:\Users\Bachir\documents\Python Scripts\Rtree-0.8.2> python setup.py install
Traceback (most recent call last):
File "setup.py", line 4, in <module>
import rtree
File "C:\Users\Bachir\documents\Python Scripts\Rtree-0.8.2\rtree\__init__.py", line 1, in <module>
from .index import Rtree
File "C:\Users\Bachir\documents\Python Scripts\Rtree-0.8.2\rtree\index.py", line 6, in <module>
from . import core
File "C:\Users\Bachir\documents\Python Scripts\Rtree-0.8.2\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
PS C:\Users\Bachir\documents\Python Scripts\Rtree-0.8.2>  

我下载了spacespaceindex dll文件'libspatialindex-1.8.1-win-msvc-2010-x64-x32.zip'。该文件包含32位和64位,解压缩并放在安装文件夹中,使用python setuo.py安装时,它仍然抱怨spaceindex.dll文件

Answers:


13

请看看如何将pyproj安装到arcpy中?

1)RTREE模块需要一个版本的编译libspatialindex 安装在系统(计算机),而不是简单地增加spatialindex DLL
2)的Windows没有默认的编译器在Linux或Mac OS X,因此无法安装RTREEpipsetup.py install
3)在RTreePython软件包索引页面中,在下面指定下载

Windows二进制文件http://www.lfd.uci.edu/~gohlke/pythonlibs/#rtree

这些文件是Rtree-0.8.2-cp27-none-win32.whl和Rtree-0.8.2-cp27-none-win_amd64.whl

要安装Whl文件,请下载文件并

pip install Rtree-0.8.2-cp27-none-....whl (32 or 64)

python34 platfom不支持Rtree-0.8.2-cp27-none-win32.whl
bhalitim

然后,您需要使用libspatialindex版本编译Rtree,但由于我不使用Windows,无法为您提供帮助
Gene

是否可以将这个下载的轮子包含在您自己的程序包中,并从那里安装pip?现在,我无法将rtree指定为依赖项...
Robin De Schepper

3

我有同样的问题,并通过更改Rtree中的core.py文件解决了

C:\ PROGRA〜1 \ QGIS2〜1.18 \ apps \ Python27 \ lib \ site-packages \ rtree \ core.py

并更改了这一行:

rt = _load_library('spatialindex_c.dll', ctypes.cdll.LoadLibrary)

这样 :

rt = _load_library('spatialindex_c-64.dll', ctypes.cdll.LoadLibrary)
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.