Windows10+python3.10 安装geopandas库时,所依赖的fiona库安装失败!

python安装geopandas、fiona包出错:Provide a path to gdal-config using a GDAL_CONFIG environment

下面是报错的代码:

Collecting fiona>=1.8

  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/67/5c/4e028e84a1f0cb3f8a994217cf2366360ca984dfc1433f6171de527d0dca/Fiona-1.8.21.tar.gz (1.0 MB)

  Preparing metadata (setup.py) ... error

  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.

  │ exit code: 1

  ╰─> [1 lines of output]

      A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.

      [end of output]


  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed


× Encountered error while generating package metadata.

╰─> See above for output.


note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

解决办法

1. 下载所需要的whl文件

在网站https://www.lfd.uci.edu/~gohlke/pythonlibs/ 上下载适合自己电脑版本的fiona库的whl文件,我下载了Fiona-8.21-cp310-cp310-win_amd64.whl

2. pip安装

打开windows powershell(管理员)(A)【右键点击屏幕左下角的windows标志,进行选择】,先切换到whl的下载路径(我的是默认了C盘的路径),再pip指令安装即可。

Windows10+python3.10 安装geopandas库时,所依赖的fiona库安装失败!_第1张图片

 黄色标注部分即输入的部分

PS C:\WINDOWS\system32> cd C:\Users\Administrator\Downloads

PS C:\Users\Administrator\Downloads> pip install Fiona-1.8.21-cp310-cp310-win_amd64.whl

3. 安装geopandas库

切回cmd,切换到python3.10的目录,执行以下命令:

pip install geopandas -i https://pypi.douban.com/simple/

你可能感兴趣的:(python,python,windows)