python3.8安装rasterio库遇到几个问题,
1、rasterio库依赖GDAL库,
2、rasterio库对numpy库版本有要求。
直接安装GDAL库会编译要安装vc 2005那个,4G大小,太大了,需要直接下载wheel,
在https://www.lfd.uci.edu/~gohlke/pythonlibs/下载
- rasterio‑1.2.10‑cp38‑cp38‑win_amd64.whl
- GDAL‑3.4.3‑cp38‑cp38‑win_amd64.whl
另外numpy版本升级到1.22.3,否则会提示np错误。
import rasterio as rio##要安装GDAL库
import pandas as pd
import os
shotfile=r'E:\prc\python\多因素量化难度\炮点.xlsx'
filesave=os.path.splitext(shotfile)[0]
rasterfile=r'E:\prc\python\多因素量化难度\dem.tif'
shotdata=pd.read_excel(shotfile,usecols=[0,1,2,3])###只读取线号,点号,x,y坐标
shotdata['高程']=5000
rast=rio.open(rasterfile)##读取栅格图像
temp_r=rast.read(1)##读取1波段
for i in range(le