OSError:找不到或加载spacespaceindex_c.dll

时间:2018-11-05 07:49:23

标签: python gis geopandas fiona

我已经安装了fiona,shapely,gdal,rtree和pyproj的whl文件。 Geopandas也可以通过pip install安装。但是导入时出现以下错误:

import geopandas
Traceback (most recent call last):

  File "<ipython-input-14-c9ee6bd24dbc>", line 1, in <module>
    import geopandas

  File "C:\ProgramData\Anaconda3\lib\site-packages\geopandas\__init__.py", line 1, in <module>
    from geopandas.geoseries import GeoSeries

  File "C:\ProgramData\Anaconda3\lib\site-packages\geopandas\geoseries.py", line 12, in <module>
    from geopandas.base import GeoPandasBase, _series_unary_op, _CoordinateIndexer

  File "C:\ProgramData\Anaconda3\lib\site-packages\geopandas\base.py", line 14, in <module>
    from rtree.core import RTreeError

  File "C:\ProgramData\Anaconda3\lib\site-packages\rtree\__init__.py", line 1, in <module>
    from .index import Rtree

  File "C:\ProgramData\Anaconda3\lib\site-packages\rtree\index.py", line 5, in <module>
    from . import core

  File "C:\ProgramData\Anaconda3\lib\site-packages\rtree\core.py", line 116, in <module>
    raise OSError("could not find or load spatialindex_c.dll")

OSError: could not find or load spatialindex_c.dll

以及以下错误:

import fiona
Traceback (most recent call last):

  File "<ipython-input-16-cc872b235141>", line 1, in <module>
    import fiona

  File "C:\ProgramData\Anaconda3\lib\site-packages\fiona\__init__.py", line 77, in <module>
    from fiona.collection import Collection, BytesCollection, vsi_path

  File "C:\ProgramData\Anaconda3\lib\site-packages\fiona\collection.py", line 9, in <module>
    from fiona.ogrext import Iterator, ItemsIterator, KeysIterator

  File "fiona\ogrext.pyx", line 25, in init fiona.ogrext

ImportError: cannot import name compat

有人可以在这里帮助我吗? 我无法弄清楚如何解决此问题。谢谢和问候。

1 个答案:

答案 0 :(得分:0)

您可以尝试使用conda而不是pip进行安装。

conda install -c conda-forge cenpy

请参阅CenPy文档:https://pypi.org/project/cenpy/

如果使用conda,则无需分别安装geopandas和Rtree。