我正在尝试在运行python3.7.7的macOS计算机上安装rtree。在geopandas文档中,它指示macos安装ddo时不包含rtree的“二进制轮子”(实际上不确定这是什么意思)。
我按照网站https://libspatialindex.org/#download上的说明进行操作,并使用cmake安装了软件包。当我进入VScode的终端并运行命令时
python3 -m pip install rtree
rtree已下载,但无法安装并产生错误消息:
ERROR: Command errored out with exit status 1:
command: /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/12/k00m0tq55399_9bk2svm9zjw0000gn/T/pip-install-ebn0ioj4/rtree/setup.py'"'"'; __file__='"'"'/private/var/folders/12/k00m0tq55399_9bk2svm9zjw0000gn/T/pip-install-ebn0ioj4/rtree/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/12/k00m0tq55399_9bk2svm9zjw0000gn/T/pip-install-ebn0ioj4/rtree/pip-egg-info
cwd: /private/var/folders/12/k00m0tq55399_9bk2svm9zjw0000gn/T/pip-install-ebn0ioj4/rtree/
Complete output (15 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/12/k00m0tq55399_9bk2svm9zjw0000gn/T/pip-install-ebn0ioj4/rtree/setup.py", line 3, in <module>
import rtree
File "/private/var/folders/12/k00m0tq55399_9bk2svm9zjw0000gn/T/pip-install-ebn0ioj4/rtree/rtree/__init__.py", line 1, in <module>
from .index import Rtree
File "/private/var/folders/12/k00m0tq55399_9bk2svm9zjw0000gn/T/pip-install-ebn0ioj4/rtree/rtree/index.py", line 6, in <module>
from . import core
File "/private/var/folders/12/k00m0tq55399_9bk2svm9zjw0000gn/T/pip-install-ebn0ioj4/rtree/rtree/core.py", line 143, in <module>
rt.Error_GetLastErrorNum.restype = ctypes.c_int
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py", line 377, in __getattr__
func = self.__getitem__(name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ctypes/__init__.py", line 382, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(RTLD_DEFAULT, Error_GetLastErrorNum): symbol not found
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
为解决以下问题而采取的步骤: -根据先前对类似问题的答案的建议,通过自制程序安装了postgresql
我将libspacialindex东西安装在与项目相同的目录中。这是问题所在吗?我是否缺少为此所需的一些重要包装?
我们非常感谢您的帮助,如果您需要更多信息,请告诉我。
答案 0 :(得分:0)
首先通过brew安装spaceindex,然后通过pip安装rtree:
brew install spatialindex
pip install rtree