rasterio依赖很多第三方库,我们按下面的顺序依次安装即可。
pyproj
Shapely
GDAL==3.1.4
Fiona==1.8.18
geopandas
rasterio==1.1.8
通过这个网址下载第三方库rasterio:
# 下载GDAL
https://www.lfd.uci.edu/~gohlke/pythonlibs/
# 下载rasterio
https://www.lfd.uci.edu/~gohlke/pythonlibs/#rasterio
目前上述链接打开会出错,下面得其他方法:
# gdal官网
https://gdal.org/download.html
# gdal github网址
https://github.com/OSGeo/GDAL
# gdal github离线下载whl文件
https://github.com/cgohlke/geospatial-wheels/releases
# PyPI下载
https://pypi.org/
# gdal conda安装
conda install -c conda-forge gdal
注:其实只要先安装GDAL、在安装rasterio即可安装成功。
这个好像有版本对应,GDAL==3.0.4对应rasterio==1.1.4,GDAL==3.1.4对应rasterio==1.1.8,GDAL==3.4.5对应rasterio==1.2.10
查看自己电脑可以安装什么配置的库:
pip debug --verbose
查看依赖包版本:
conda search --full-name gdal # 用它即可
# --full-name为精确查找的参数。
conda search <text> # 模糊查找
conda search gdal -info # -info 选项提供有关所搜索软件包的附加信息。
查看当前环境安装的所有依赖包:
conda list
rasterio库github地址:https://github.com/rasterio/rasterio
rasterio库稳定版文档帮助:Rasterio: access to geospatial raster data — rasterio documentation
附录
1、网址
最近发现一些网址失效,特来补充。
也可以从OpenQuake的wheelhouse网站下载GDAL的预编译whl文件:
https://wheelhouse.openquake.org/
还有另外一个网址:
https://girder.github.io/large_image_wheels/
2、linux的安装
可以使用以下命令安装这些依赖库(以Ubuntu为例):
sudo apt-get update
sudo apt-get install gdal-bin libgdal-dev libgeos-dev libproj-dev libsqlite3-dev
然后,我们可以使用以下命令安装Python的OSGeo库:
pip install GDAL