在Anacond中安装geopandas时出错:“必须指定GDAL API版本”

2024-04-29 03:24:38 发布

您现在位置:Python中文网/ 问答频道 /正文

安装geopandas时引发此错误。我在网上寻找它的解决方案,但没有一个能真正解释发生了什么以及如何解决它。。 这是完全错误:

    Collecting geopandas
  Using cached https://files.pythonhosted.org/packages/24/11/d77c157c16909bd77557d00798b05a5b6615ed60acb5900fbe6a65d35e93/geopandas-0.4.0-py2.py3-none-any.whl
Requirement already satisfied: shapely in c:\users\alvaro\anaconda3\envs\tfdeeplearning\lib\site-packages (from geopandas) (1.6.4.post2)
Requirement already satisfied: pandas in c:\users\alvaro\anaconda3\envs\tfdeeplearning\lib\site-packages (from geopandas) (0.20.3)
Collecting fiona (from geopandas)
  Using cached https://files.pythonhosted.org/packages/3a/16/84960540e9fce61d767fd2f0f1d95f4c63e99ab5d8fddc308e8b51b059b8/Fiona-1.8.4.tar.gz
    Complete output from command python setup.py egg_info:
    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.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Alvaro\AppData\Local\Temp\pip-install-oxgkjg8l\fiona\

Tags: infromhttpsorgpackages错误filesrequirement
3条回答
pip install wheels
pip install pipwin

pipwin install numpy
pipwin install pandas
pipwin install shapely
pipwin install gdal
pipwin install fiona
pipwin install pyproj
pipwin install six
pipwin install rtree
pipwin install geopandas

以下是源链接: http://geopandas.org/install.html#installationhttps://pip.pypa.io/en/latest/user_guide/#installing-from-wheelshttps://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy

如果仍然有问题,请考虑卸载上面的(pip uninstall)并重新安装。

我可以安装geopandas的一种方法是通过Anaconda导航器。进入环境并安装“geopandas”软件包。之后我可以在spyder中导入geopandas包

地理空间数据抽象库(GDAL)是为矢量地理空间数据格式设计的库。这是安装菲奥娜的前提,Python API是OGR(^ {A1}),这又是Geopand的先决条件。在类UNIX系统中,^ {< CD1> }脚本告诉菲奥娜关于特定的^ {< CD2> }安装的内容。

<>你的^ {< CD1>}不在你的路径中的一个通常的地方,所以菲奥娜找不到它。

如果你用的是水蟒,最好是用conda remove gdal去除gdal,然后再做一次新鲜的conda install geopandas

一般来说,如果你使用Conda,你不应该使用pip在里面安装东西,除非你确定Conda不支持它。(通过指定正确的通道--c参数,可以在conda上找到许多包。)特别是在geopandas的情况下,使用conda over pip的maintainers recommend,因为pip要求您正确安装依赖项。

相关问题 更多 >