问题
I try to install the module contextily to use it on Python.
I went on Anaconda Prompt as admin, and wrote : pip install contextily
I get this error and I have still not found what I have to do :
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command:'C:\Users\elise\AppData\Local\Continuum\anaconda3\python.exe' 'C:\Users\elise\AppData\Local\Continuum\anaconda3\lib\site-packages\pip_vendor\pep517_in_process.py' get_requires_for_build_wheel 'C:\Users\elise\AppData\Local\Temp\tmpwkajt8gq' cwd: C:\Users\elise\AppData\Local\Temp\pip-install-ysq517b2\rasterio
Complete output (2 lines):
INFO:root:Building on Windows requires extra options to setup.py to locate needed GDAL files. More information is available in the README.
ERROR: A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIGenvironment variable or use a GDAL_VERSION environment variable.
ERROR: Command errored out with exit status 1: 'C:\Users\elise\AppData\Local\Continuum\anaconda3\python.exe' 'C:\Users\elise\AppData\Local\Continuum\anaconda3\lib\site-packages\pip_vendor\pep517_in_process.py' get_requires_for_build_wheel 'C:\Users\elise\AppData\Local\Temp\tmpwkajt8gq' Check the logs for full command output.
(I tried to deal with environment variable like there : No module named ogr but it doesn't help. Neither these solutions : Error installing geopandas:" A GDAL API version must be specified " in Anaconda)
回答1:
I achieved to install packages that I couldn't before, by creating a virtual environment and working on it (it's simple on Anaconda Navigator : Environments/Create, and then using the right part of the navigator to install new packages)
回答2:
As a python beginner I ran in the same error but https://anaconda.org/conda-forge/contextily and conda install -c conda-forge contextily worked for me.
来源:https://stackoverflow.com/questions/62328395/python-pip-install-error-a-gdal-api-version-must-be-specified