错误代码:
ERROR: Command errored out with exit status 1:
command: 'c:\python37\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\11931\\AppData\\Local\\Temp\\pip-install-yy0nccti\\fiona\\setup.py'"'"'; __file__='"'"'C:\\Users\\11931\\AppData\\Local\\Temp\\pip-install-yy0nccti\\fiona\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\11931\AppData\Local\Temp\pip-pip-egg-info-kk517f2i'
cwd: C:\Users\11931\AppData\Local\Temp\pip-install-yy0nccti\fiona\
Complete output (1 lines):
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.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
解决方案:
这里的错误大概率是gdal造成的,但是我已经安装了gdal,并且一直在用,所以可能是某个参数设置的问题。
查看geopandas文档(https://geopandas.org/install.html#dependencies),发现geopandas的依赖包是:
numpy
pandas (version 0.23.4 or later)
shapely (interface to GEOS)
fiona (interface to GDAL)
pyproj (interface to PROJ; version 2.2.0 or later)
所以这个问题可能是出在fiona上。
于是尝试pip install fiona,失败,报错与上述错误一致,说明是fiona的问题,重新下载fiona(https://www.lfd.uci.edu/~gohlke/pythonlibs/#fiona),然后离线安装,之后再pip install geopandas,成功