当前位置:   article > 正文

python安装gdal包_python安装gdal的两种方法

python gdal 离线包下载

1.不用手动下载文件,直接执行以下命令即可

conda install gdal

2.首先,下载gdal的whl文件  链接, 官网下载比较慢,GDAL-2.2.4-cp27-cp27m-win_amd64.whl

链接: https://pan.baidu.com/s/1prPHLJKwoKK505i5qTVZ7g

提取码: egj6

有百度云可以下载,然后放入本机目录。

这里目录有两种,一是放入anaconda安装目录的Scripts目录,我的是D:\anaconda\Scripts目录;二是放入Anaconda环境的Scripts目录,我的是D:\anaconda\envs\uav\Scripts(uav是我自己的环境,可通过命令conda create -n name python=3.6创建环境)。

最后,在D:\Anaconda3\Scripts目录下在空白处按住shift加右键打开cmd,输入以下命令即可。

pip install GDAL‑3.0.1‑cp38‑cp38‑win_amd64.whl

注:若用pip安装gdal会报错:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gdal

报错信息如下:

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple

Collecting gdal

Downloading https://pypi.tuna.tsinghua.edu.cn/packages/26/c6/f8846ba726b37f9a1099acb5bff43c309fb913577674c1ba491f6fc60598/GDAL-3.0.1.tar.gz (576kB)

|████████████████████████████████| 583kB 810kB/s

Building wheels for collected packages: gdal

Building wheel for gdal (setup.py) ... error

ERROR: Complete output from command /home/dennis/miniconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-i321u6em/gdal/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-aaneihet --python-tag cp37:

ERROR: running bdist_wheel

running build

running build_py

creating build

creating build/lib.linux-x86_64-3.7

copying gdal.py -> build/lib.linux-x86_64-3.7

copying ogr.py -> build/lib.linux-x86_64-3.7

copying osr.py -> build/lib.linux-x86_64-3.7

copying gdalconst.py -> build/lib.linux-x86_64-3.7

copying gdalnumeric.py -> build/lib.linux-x86_64-3.7

creating build/lib.linux-x86_64-3.7/osgeo

copying osgeo/gdalconst.py -> build/lib.linux-x86_64-3.7/osgeo

copying osgeo/gdalnumeric.py -> build/lib.linux-x86_64-3.7/osgeo

copying osgeo/osr.py -> build/lib.linux-x86_64-3.7/osgeo

copying osgeo/gnm.py -> build/lib.linux-x86_64-3.7/osgeo

copying osgeo/__init__.py -> build/lib.linux-x86_64-3.7/osgeo

copying osgeo/ogr.py -> build/lib.linux-x86_64-3.7/osgeo

copying osgeo/gdal.py -> build/lib.linux-x86_64-3.7/osgeo

copying osgeo/gdal_array.py -> build/lib.linux-x86_64-3.7/osgeo

Fixing build/lib.linux-x86_64-3.7/gdal.py build/lib.linux-x86_64-3.7/ogr.py build/lib.linux-x86_64-3.7

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/172364
推荐阅读
相关标签
  

闽ICP备14008679号