【问题标题】:Installing fiona: Must the gdal version be compatible with fiona?安装fiona:gdal版本必须兼容fiona吗?
【发布时间】:2021-10-28 13:57:01
【问题描述】:

我在 Windows 上并通过 Anaconda 使用 Python。

Python 3.8.8,64 位 AMD64

  1. 我从
    https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
    https://www.lfd.uci.edu/~gohlke/pythonlibs/#fiona 下载了 gdal 和 fiona 车轮

GDAL-3.2.3-cp38-cp38-win_amd64.whl
Fiona-1.8.20-cp38-cp38-win_amd64.whl

  1. 成功安装gdal: 版本 3.2.3

  2. 添加名为 GDAL_DATA 和 value = 的环境变量

C:\Users\yourUserName\AppData\Local\Programs\Python\Python38-32\Lib\site-packages\osgeo\data\gdal

  1. 安装的 Visual C++ 构建工具来自 https://visualstudio.microsoft.com/visual-cpp-build-tools/

  2. 重新启动我的电脑

  3. pip install C:/Users/Asus/anaconda3/Lib/Fiona-1.8.20-cp38-cp38-win_amd64.whl

但是在第6步构建gdal轮总是有错误。

Using cached gdal 3.3.1.tar.gz .....

Failed in building wheels for gdal ...

为什么我已经安装了 gdal 还需要 fiona 为 gdal 制作轮子? 我已将安装的 gdal 的路径添加到环境变量中。

【问题讨论】:

    标签: python fiona


    【解决方案1】:

    我必须使用

    菲奥娜-1.8.19-cp38-cp38-win_amd64.whl

    【讨论】:

    • 请添加更多详细信息以扩展您的答案,例如工作代码或文档引用。
    【解决方案2】:

    我试图使用 gpd.read_file 读取 .shp 文件,

    shapefile = gpd.read_file(r'C:\Users\abhir....\shapefiles\louisville.shp')
    

    引发 ImportError

    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.
    

    显然,我使用了不同版本的 GDAL 和 fiona 组合。

    GDAL-3.3.2-cp38-cp38-win_amd64.whl

    Fiona-1.8.20-cp38-cp38-win_amd64.whl

    我必须卸载以上版本并安装以下版本。它解决了这个问题。

    GDAL-3.2.3-cp38-cp38-win_amd64.whl

    菲奥娜-1.8.19-cp38-cp38-win_amd64.whl

    【讨论】:

    • GDal 3.2.3 甚至不存在。请参阅releases。但是,Fiona 1.8.19 和 GDal 3.2.2 似乎是兼容的。
    猜你喜欢
    • 2019-04-13
    • 2020-10-18
    • 1970-01-01
    • 2021-03-24
    • 1970-01-01
    • 2011-11-09
    • 2017-12-26
    • 2020-06-19
    • 2019-08-04
    相关资源
    最近更新 更多