首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在没有sudo权限的情况下安装libspatialindex索引

如何在没有sudo权限的情况下安装libspatialindex索引
EN

Stack Overflow用户
提问于 2022-03-10 06:56:28
回答 1查看 116关注 0票数 0

我的代码是

代码语言:javascript
复制
from geopandas.tools import sjoin
ref_bts_adm = sjoin(Airport, ref_adm, how='left', op = 'within')

错误信息

代码语言:javascript
复制
--------------------------------------------------------------------------
ImportError                              Traceback (most recent call last)
<ipython-input-10-5c31e9843a8a> in <module>
      1 from geopandas.tools import sjoin
----> 2 ref_bts_adm = sjoin(Airport, ref_adm, how='left', op = 'within')

~/.local/lib/python3.6/site-packages/geopandas/tools/sjoin.py in sjoin(left_df, right_df, how, op, lsuffix, rsuffix)
     87     _basic_checks(left_df, right_df, how, lsuffix, rsuffix)
     88 
---> 89     indices = _geom_predicate_query(left_df, right_df, op)
     90 
     91     joined = _frame_join(indices, left_df, right_df, how, lsuffix, rsuffix)

~/.local/lib/python3.6/site-packages/geopandas/tools/sjoin.py in _geom_predicate_query(left_df, right_df, op)
    171             # see discussion at https://github.com/geopandas/geopandas/pull/1421
    172             predicate = "contains"
--> 173             sindex = left_df.sindex
    174             input_geoms = right_df.geometry
    175         else:

~/.local/lib/python3.6/site-packages/geopandas/base.py in sindex(self)
   2628                [2]])
   2629         """
-> 2630         return self.geometry.values.sindex
   2631 
   2632     @property

~/.local/lib/python3.6/site-packages/geopandas/array.py in sindex(self)
    307     def sindex(self):
    308         if self._sindex is None:
--> 309             self._sindex = _get_sindex_class()(self.data)
    310         return self._sindex
    311 

~/.local/lib/python3.6/site-packages/geopandas/sindex.py in _get_sindex_class()
     20         return RTreeIndex
     21     raise ImportError(
---> 22         "Spatial indexes require either `rtree` or `pygeos`. "
     23         "See installation instructions at https://geopandas.org/install.html"
     24     )

ImportError: Spatial indexes require either `rtree` or `pygeos`. See installation instructions at https://geopandas.org/install.html

基本上,我也有类似的错误

在重力场,但rtree被安装

但我没有正确的选择

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-06-03 13:59:10

我也遇到了类似的问题,并通过斯派克安装了斯派克,例如spack install libspatialindex (注意:这会在您的家中安装库,并且不需要sudo特权)。然后,您可以使用pip install pygeos和rtree,如其他答案所示。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71419958

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档