Abh*_*ram 19 python importerror fiona
尝试读取 shapefile (.shp) 并在执行以下代码行后收到ImportError 。在执行下面的代码之前,我什至 pip 安装了 GDAL、geopandas、fiona 和 shapely。
shapefile = gpd.read_file(r'C:\Users\....\Data Analysis\shapefiles\louisville.shp')
Run Code Online (Sandbox Code Playgroud)
收到的错误如下,
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-164-16243badadbe> in <module>
----> 1 shapefile = gpd.read_file(r'C:\Users\....\Data Analysis\shapefiles\louisville.shp')
~\Anaconda3\lib\site-packages\geopandas\io\file.py in _read_file(filename, bbox, mask, rows, **kwargs)
164 by using the encoding keyword parameter, e.g. ``encoding='utf-8'``.
165 """
--> 166 _check_fiona("'read_file' function")
167 filename = _expand_user(filename)
168
~\Anaconda3\lib\site-packages\geopandas\io\file.py in _check_fiona(func)
78 def _check_fiona(func):
79 if fiona is None:
---> 80 raise ImportError(
81 f"the {func} requires the 'fiona' package, but it is not installed or does "
82 f"not import correctly.\nImporting fiona resulted in: {fiona_import_error}"
ImportError: the 'read_file' function requires the 'fiona' package, but it is not installed or does not import correctly.
Importing fiona resulted in: DLL load failed while importing ogrext: The specified procedure could not be found.
Run Code Online (Sandbox Code Playgroud)
Abh*_*ram 11
显然,我使用的是以下版本的 GDAL 和 fiona 组合,这对我不起作用。
\nGDAL-3.3.2-cp38-cp38-win_amd64.whl
\n菲奥娜-1.8.20-cp38-cp38-win_amd64.whl
\n我必须卸载上述版本并安装以下版本。这解决了这个问题。
\nGDAL-3.2.3-cp38-cp38-win_amd64.whl
\n菲奥娜\xe2\x80\x911.8.19\xe2\x80\x91cp38\xe2\x80\x91cp38\xe2\x80\x91win_amd64.whl
\n