记录一个pip install rasterio 安装问题处理过程

僤鯓⒐⒋嵵緔 提交于 2020-08-10 06:28:26

首先使用 pip 安装,过程如下

Windows PowerShell
版权所有 (C) Microsoft Corporation。保留所有权利。

尝试新的跨平台 PowerShell https://aka.ms/pscore6

加载个人及系统配置文件用了 811 毫秒。
(base) PS C:\WINDOWS\system32> pip install rasterio
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting rasterio
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/86/43/aae52a19a69ee30d28d0374c5f22d473ba3ba98ace4a5a5330a26590df95/rasterio-1.1.5.tar.gz (2.2 MB)
     |████████████████████████████████| 2.2 MB 1.7 MB/s
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: 'D:\ProgramData\Anaconda3\python.exe' 'D:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'C:\Users\lenovo\AppData\Local\Temp\tmpjjo12d2l'
       cwd: C:\Users\lenovo\AppData\Local\Temp\pip-install-p5755cpx\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_CONFIG environment variable or use a GDAL_VERSION environment variable.
  ----------------------------------------
ERROR: Command errored out with exit status 1: 'D:\ProgramData\Anaconda3\python.exe' 'D:\ProgramData\Anaconda3\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'C:\Users\lenovo\AppData\Local\Temp\tmpjjo12d2l' Check the logs for full command output.
(base) PS C:\WINDOWS\system32>

解决方法是使用conda安装。

conda install -c conda-forge gdal
conda install -c conda-forge/label/cf202003 gdal
conda install -c conda-forge/label/gcc7 gdal
conda install -c conda-forge/label/broken gdal
conda install -c conda-forge/label/TEST gdal
conda install -c conda-forge/label/cf201901 gdal 

参考链接:

https://anaconda.org/conda-forge/gdal

https://gdal.org/download.html#current-releases

conda安装速度慢或无法安装参考博客前期文章。

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!