gpt4 book ai didi

python-3.x - AttributeError : dlsym(RTLD_DEFAULT, Error_GetLastErrorNum:找不到符号

转载 作者:行者123 更新时间:2023-12-05 09:04:33 26 4
gpt4 key购买 nike

我最近下载了 OSMnx 包来处理街道网络。但是,每当我尝试导入包时,它总是给我返回以下错误。我已经按照其他帖子的人建议的几个步骤进行操作,但没有任何改变。如果有人遇到过这个问题或知道解决方法,请与我分享。谢谢!

Traceback (most recent call last):
File "/Users/qle/Documents/OSMnx/test.py", line 1, in <module>
import osmnx as ox
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/osmnx/__init__.py", line 3, in <module>
from ._api import *
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/osmnx/_api.py", line 3, in <module>
from .bearing import add_edge_bearings
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/osmnx/bearing.py", line 9, in <module>
from . import projection
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/osmnx/projection.py", line 3, in <module>
import geopandas as gpd
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/geopandas/__init__.py", line 1, in <module>
from geopandas._config import options # noqa
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/geopandas/_config.py", line 126, in <module>
default_value=_default_use_pygeos(),
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/geopandas/_config.py", line 112, in _default_use_pygeos
import geopandas._compat as compat
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/geopandas/_compat.py", line 202, in <module>
import rtree # noqa
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/rtree/__init__.py", line 9, in <module>
from .index import Rtree, Index # noqa
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/rtree/index.py", line 6, in <module>
from . import core
File "/Users/qle/Library/Python/3.8/lib/python/site-packages/rtree/core.py", line 77, in <module>
rt.Error_GetLastErrorNum.restype = ctypes.c_int
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ctypes/__init__.py", line 386, in __getattr__
func = self.__getitem__(name)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ctypes/__init__.py", line 391, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: dlsym(RTLD_DEFAULT, Error_GetLastErrorNum): symbol not found

最佳答案

您的错误意味着 rtreeosmnx 的依赖项,找不到 spatialindex

首先,确保安装了 spatialindex:

brew install spatialindex

下一个问题是 rtree 只检查 very specific locations对于 spatialindex 但 brew 安装到 /opt/homebrew/Cellar

您设置 ENV 变量并检查这是否是问题所在

export SPATIALINDEX_C_LIBRARY='/opt/homebrew/Cellar/spatialindex/1.9.3/lib'

python -c 'import geopandas'

它应该可以工作。但是,根据您的空间索引和 brew 版本,此路径可能会发生变化。

关于python-3.x - AttributeError : dlsym(RTLD_DEFAULT, Error_GetLastErrorNum:找不到符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68464704/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com