问题
I need to install Geopandas which depends on Fiona and GDAL with pip on Python 3.6. I have installed the GDAL library on Python using the wheel file downloaded from here.
Processing c:\users\_chena\downloads\gdal-2.4.1-cp36-cp36m-win_amd64.whl
Installing collected packages: GDAL
Successfully installed GDAL-2.4.1
Then I tried to pip3 install geopandas
. I encountered the following error:
Collecting geopandas
Downloading https://files.pythonhosted.org/packages/f0/5d/916b7268ef551fa9647c
e12220e9a68006374f1ce5b0ddaf1cd0df2880b7/geopandas-0.4.1-py2.py3-none-any.whl (9
22kB)
100% |████████████████████████████████| 931kB 4.1MB/s
Requirement already satisfied: pandas in d:\aaa_workspace\alex\supportsarah\hist
oricalplanburnwindowsproject\venv\lib\site-packages (from geopandas) (0.24.1)
Requirement already satisfied: shapely in d:\aaa_workspace\alex\supportsarah\his
toricalplanburnwindowsproject\venv\lib\site-packages (from geopandas) (1.6.4.pos
t1)
Collecting fiona (from geopandas)
Downloading https://files.pythonhosted.org/packages/41/9d/63696e7b1de42aad294d
4781199a408bec593d8fdb80a2b4a788c911a33b/Fiona-1.8.6.tar.gz (1.7MB)
100% |████████████████████████████████| 1.7MB 7.9MB/s
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\_chena\A
ppData\Local\Temp\2\pip-install-vy05tre2\fiona\
I can't find anywhere that the gdal-data directory is located. Given the error log as such 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.
, how can I go about setting the GDAL_CONFIG environment variable with the Python GDAL library installed through pip3?
回答1:
The only solution seems to be installing the ready binaries from here ~gohlke
https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal
Then, just install the required libraries locally. For me, I did the following in this order (Python 3.8.6
)
pip install GDAL-3.1.4-cp38-cp38-win_amd64.whl
pip install Fiona-1.8.18-cp38-cp38-win_amd64.whl
pip install geopandas-0.8.1-py3-none-any.whl
来源:https://stackoverflow.com/questions/55583234/installation-fails-for-fiona-and-geopandas-with-gdal-on-python-3-6-on-microsoft