记录一个pip install rasterio 安装问题处理过程
首先使用 pip 安装,过程如下
Windows PowerShell
版权所有 (C) Microsoft Corporation。保留所有权利。
尝试新的跨平台 PowerShell https://aka.ms/pscore6
加载个人及系统配置文件用了 811 毫秒。
(base) PS C:WINDOWSsystem32> 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:ProgramDataAnaconda3python.exe" "D:ProgramDataAnaconda3libsite-packagespip\_vendorpep517\_in_process.py" get_requires_for_build_wheel "C:UserslenovoAppDataLocalTemp mpjjo12d2l"
cwd: C:UserslenovoAppDataLocalTemppip-install-p5755cpxasterio
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:ProgramDataAnaconda3python.exe" "D:ProgramDataAnaconda3libsite-packagespip\_vendorpep517\_in_process.py" get_requires_for_build_wheel "C:UserslenovoAppDataLocalTemp mpjjo12d2l" Check the logs for full command output.
(base) PS C:WINDOWSsystem32>
解决方法是使用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安装速度慢或无法安装参考博客前期文章。