【发布时间】:2020-04-28 00:25:00
【问题描述】:
我正在尝试在运行 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 的东西安装在与我的项目相同的目录中。这是问题所在吗?我是否错过了一些重要的包?
非常感谢任何帮助,如果您需要更多信息,请告诉我。
【问题讨论】:
-
如果可以,请使用 conda-forge 中的 conda 安装 GeoPandas 及其所有依赖项。 geopandas.readthedocs.io/en/latest/… 这将处理所有这些 C 依赖项。
-
@martinfleis 是正确的,安装最新版本的 anaconda 解决了所有这些问题。谢谢。
标签: python-3.x postgresql macos cmake geopandas