2

我已经为 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

有人可以在这里帮助我吗?我无法弄清楚如何解决这个问题。谢谢并恭祝安康。

4

1 回答 1

0

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

conda install -c conda-forge cenpy

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

如果使用 conda,则不需要单独安装 geopandas 和 Rtree。

于 2020-04-02T20:06:18.703 回答