![RHEL 中的 Geopandas 导入错误](https://linux22.com/image/1594213/RHEL%20%E4%B8%AD%E7%9A%84%20Geopandas%20%E5%AF%BC%E5%85%A5%E9%94%99%E8%AF%AF.png)
我在 RHEL 服务器上安装了 Geopandas 及其依赖项 Rtree。当我尝试导入 geopandas 时,它抛出了以下错误
File "<stdin>", line 1, in <module>
File "/root/anaconda3/envs/py3.6.5/lib/python3.7/site-packages/geopandas/__init__.py", line 1, in <module>
from geopandas.geoseries import GeoSeries
File "/root/anaconda3/envs/py3.6.5/lib/python3.7/site-packages/geopandas/geoseries.py", line 13, in <module>
from geopandas.base import GeoPandasBase, _unary_op, _CoordinateIndexer
File "/root/anaconda3/envs/py3.6.5/lib/python3.7/site-packages/geopandas/base.py", line 17, in <module>
from rtree.core import RTreeError
File "/root/anaconda3/envs/py3.6.5/lib/python3.7/site-packages/rtree/__init__.py", line 1, in <module>
from .index import Rtree
File "/root/anaconda3/envs/py3.6.5/lib/python3.7/site-packages/rtree/index.py", line 5, in <module>
from . import core
File "/root/anaconda3/envs/py3.6.5/lib/python3.7/site-packages/rtree/core.py", line 127, in <module>
rt = ctypes.CDLL(lib_name)
File "/root/anaconda3/envs/py3.6.5/lib/python3.7/ctypes/__init__.py", line 356, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libspatialindex_c.so.4: cannot open shared object file: No such file or directory
当我环顾解决方案时,我才知道我必须安装空间索引(https://github.com/libspatialindex/libspatialindex/wiki/1.-Getting-Started)我已按照提供的步骤进行配置(http://toblerity.org/rtree/install.html),但问题仍然没有解决。我无法在我的 python 中导入 geopandas 和 rtree。
PS:我正在我创建的 python 虚拟环境中完成所有这些安装。
任何帮助都将非常感激。
答案1
如果可能的话,尝试一个 Ubuntu 基础,在那里你将有 apt-get install python3-rtree 我不是 100%确定它会解决问题,现在我无法测试它。