python gdal 安装使用(Windows, python 3.6.8)

佚名 / 2024-06-10 / 原文

python gdal 安装使用


python GDAL有两种安装方式:

第一种 是利用 pip install gdal 安装

如果安装失败,可以采用下面的方法:
第二种 离线安装

步骤:

(1)查看python版本;(2)下载gdal的whl文件;(3)利用pip install 下载的gdal.whl文件;(4)将gdal中的可执行文件所在路径添加到系统环境中;

具体操作见下图(下图默认在windows系统下安装了Anaconda,并使用Anaconda Prompt终端):
(一)、步骤1:  查看Python版本:

python -V      
Python 3.6.8



(二)、步骤2: 下载gdal的whl文件
Python的whl下载网站,

https://girder.github.io/large_image_wheels/

https://wheelhouse.openquake.org/windows/py36/

https://wheelhouse.openquake.org/windows/py36/GDAL-3.1.4-cp36-cp36m-win_amd64.whl

 

ctrl+F快速搜索gdal,并选择和python版本号一致的whl文件:本电脑的python是3.6即cp36,   安装在windows平台 即win, 最后是电脑是64位 即64

GDAL-3.1.4-cp36-cp36m-win_amd64.whl

 


(三)、步骤3: 安装gdal的whl文件

pip install gdal的whl文件路径

 pip install GDAL-3.1.4-cp36-cp36m-win_amd64.whl


pip list 可以查看是否安装上了



(四)、步骤4  将gdal中的可执行文件所在路径添加到系统环境中(Path变量)
先找到 gdalinfo.exe 路径

然后将该路径添加到系统环境变量中(Path变量中)

 


————————————————
参考:https://blog.csdn.net/weixin_44702962/article/details/136631946