简体   繁体   中英

Provide a path to gdal-config using a GDAL_CONFIG environment variable error while attempting to install Fiona

This is the error I receive:

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.

after running the command:

pip install Fiona

from the command line. I had to install GDAL manually from a wheel file found here (python 3.7 32bit): https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal

I have looked for a solution to this but the suggested solution is to uninstall and reinstall GDAL through Conda, and I am unable to use Conda.

If anyone could tell me simply where the gdal-config file is that would be fantastic so I can add it to my environment variables. A solution is also very welcome.

This doesn't show where the gdal-config file is, but solves your fiona issue.

First download the relevant wheel file (looks like Fiona‑1.8.4‑cp37‑cp37m‑win32.whl is what you're after and it's available at the site you linked: https://www.lfd.uci.edu/~gohlke/pythonlibs/#fiona ).

Then use this command (changing the path to where you file is):

pip install C:/path/to/Fiona‑1.8.4‑cp37‑cp37m‑win32.whl

More info here: https://pip.pypa.io/en/latest/user_guide/#installing-from-wheels and How do I install a Python package with a .whl file?

2 years later, but I thought I would share some insight into this question for anyone who happens on it.

I installed GDAL using https://trac.osgeo.org/osgeo4w/#QuickStartforOSGeo4WUsers . You don't need to install the osgeo GUI or anything, you can manually select what packages you want to install. Additionally it allows the easy install of a bunch of other useful related binaries that are used by many other packages (the one I specifically was having trouble with was cartopy).

After this, start adding things to your path envvar (for windows). For me, I added: C:\\OSGeo4W64\\bin and C:\\OSGeo4W64\\include to my path envvar and was able to get everything working after that. I could simply pip install at the command line with no issue.

This was done as an alternative to conda , as conda took 12 hours to tell me it couldn't install the package.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM