有没有办法修复 geopandas 的这个导入错误?

时间:2021-02-25 16:26:36

标签: python dll importerror geopandas

我正在尝试让 GemGIS 工作。在安装过程中,我通过以下方式在我的环境中安装了库 geopandasgemgis

conda install -c conda-forge geopandas

pip install gemgis

我使用了 anaconda powershell,一切似乎都没问题。当我启动 jupyter 实验室并尝试导入这些包时,我收到以下错误代码:

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-24-a62d01c1d62e> in <module>
----> 1 import geopandas as gpd

G:\Programme\anaconda3\envs\gemgis\lib\site-packages\geopandas\__init__.py in <module>
----> 1 from geopandas._config import options  # noqa
      2 
      3 from geopandas.geoseries import GeoSeries  # noqa
      4 from geopandas.geodataframe import GeoDataFrame  # noqa
      5 from geopandas.array import points_from_xy  # noqa

G:\Programme\anaconda3\envs\gemgis\lib\site-packages\geopandas\_config.py in <module>
    124 use_pygeos = Option(
    125     key="use_pygeos",
--> 126     default_value=_default_use_pygeos(),
    127     doc=(
    128         "Whether to use PyGEOS to speed up spatial operations. The default is True "

G:\Programme\anaconda3\envs\gemgis\lib\site-packages\geopandas\_config.py in _default_use_pygeos()
    110 
    111 def _default_use_pygeos():
--> 112     import geopandas._compat as compat
    113 
    114     return compat.USE_PYGEOS

G:\Programme\anaconda3\envs\gemgis\lib\site-packages\geopandas\_compat.py in <module>
    147 RTREE_GE_094 = False
    148 try:
--> 149     import rtree  # noqa
    150 
    151     HAS_RTREE = True

G:\Programme\anaconda3\envs\gemgis\lib\site-packages\rtree\__init__.py in <module>
      7 __version__ = '0.9.7'
      8 
----> 9 from .index import Rtree, Index  # noqa

G:\Programme\anaconda3\envs\gemgis\lib\site-packages\rtree\index.py in <module>
      4 import pprint
      5 
----> 6 from . import core
      7 
      8 import pickle

G:\Programme\anaconda3\envs\gemgis\lib\site-packages\rtree\core.py in <module>
     73 
     74 # load the shared library by looking in likely places
---> 75 rt = finder.load()
     76 
     77 rt.Error_GetLastErrorNum.restype = ctypes.c_int

G:\Programme\anaconda3\envs\gemgis\lib\site-packages\rtree\finder.py in load()
     65             finally:
     66                 os.environ['PATH'] = oldenv
---> 67         raise OSError("could not find or load {}".format(lib_name))
     68 
     69     elif os.name == 'posix':

OSError: could not find or load spatialindex_c-64.dll
'''

Does anyone know how to fix this? I looked up the paths and saw, that the core.py data had similar codes as requested, but the **64** was missing at the end of the spatialindex_c-.dll 

1 个答案:

答案 0 :(得分:0)

您安装的 rtree 已损坏。您可以尝试重新安装它或改用 pygeos

推荐方式(因为我看到您使用的是 conda):

conda install rtree -c conda-forge

conda install pygeos -c conda-forge

使用 pygeos,不使用 rtree,因此不会引发错误。