python安装gdal的两种方法

更新时间:2023-06-27 16:59:44 阅读: 评论:0

python安装gdal的两种⽅法
1.不⽤⼿动下载⽂件,直接执⾏以下命令即可
conda install gdal
2.⾸先,下载gdal的whl⽂件,官⽹下载⽐较慢,GDAL-2.2.4-cp27-cp27m-win_amd64.whl
提取码: 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会报错:
报错信息如下:
Looking in indexes: pypi.tuna.tsinghua.edu/simple
Collecting gdal
礼器碑高清字帖
数字化城市管理Downloading pypi.tuna.tsinghua.edu/packages/26/c6/f8846ba726b37f9a1099acb5bff43c309fb913577674c1ba491f6fc60598/GDAL-3.0. (576kB)
|████████████████████████████████| 583kB 810kB/s
Building wheels for collected packages: gdal
Building wheel for gdal (tup.py) ... error
ERROR: Complete output from command /home/dennis/miniconda3/bin/python -u -c 'import tuptools, tokenize;__file__='"'"'/tmp/pip-install-i321u6em/gdal/tup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);ad().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.clos  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/osr.py build/lib.linux-x86_64-3.7/gdalconst.py build/lib.linux-x86_64-3.7/gdalnumeric.py build/lib.linux-x86_64-3.7/osgeo/gdalconst.py build/lib.linux-x86_64-3.7/osg  Skipping optional fixer: ws_comma
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/os
r.py build/lib.linux-x86_64-3.7/gdalconst.py build/lib.linux-x86_64-3.7/gdalnumeric.py build/lib.linux-x86_64-3.7/osgeo/gdalconst.py build/lib.linux-x86_64-3.7/osg  Skipping optional fixer: ws_comma
running build_ext
gcc -pthread -B /home/dennis/miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/home/dennis/minicond  gcc -pthread -B /home/dennis/miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/home/dennis/minicond  building 'osgeo._gdal' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/extensions
gcc -pthread -B /home/dennis/miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/home/dennis/minicond  cc1plus: warning: command line option ‘-Wstrict-prototypes' is valid for C/ObjC but not for C++
extensions/gdal_wrap.cpp:4075:1: error: ‘VSIDIR' does not name a type
VSIDIR* wrapper_VSIOpenDir( const char * utf8_path,
^
extensions/gdal_wrap.cpp:4123:38: error: ‘VSIDIR' was not declared in this scope
DirEntry* wrapper_VSIGetNextDirEntry(VSIDIR* dir)
^
extensions/gdal_wrap.cpp:4123:46: error: ‘dir' was not declared in this scope
DirEntry* wrapper_VSIGetNextDirEntry(VSIDIR* dir)
^
extensions/gdal_wrap.cpp:4124:1: error: expected ‘,' or ‘;' before ‘{' token
{
^
extensions/gdal_wrap.cpp:3225:7: warning: ‘char* get_aligned_buffer(char*, GDALDataType)' defined but not ud [-Wunud-function]
char* get_aligned_buffer(char* data, GDALDataType ntype)
往生人
^
extensions/gdal_wrap.cpp:3244:13: warning: ‘void update_buffer_size(void*, char*, char*, size_t)' defined but not ud [-Wunud-function]
static void update_buffer_size(void* obj, char* data, char* data_aligned, size_t buf_size)
^
extensions/gdal_wrap.cpp:3299:5: warning: ‘int GetUExceptions()' defined but not ud [-Wunud-function]
int GetUExceptions() {
^
extensions/gdal_wrap.cpp:3305:6: warning: ‘void UExceptions()' defined but not ud [-Wunud-function]
void UExceptions() {
^
extensions/gdal_wrap.cpp:3322:6: warning: ‘void DontUExceptions()' defined but not ud [-Wunud-function]
void DontUExceptions() {
^
extensions/gdal_wrap.cpp:3370:13: warning: ‘void ClearErrorState()' defined but not ud [-Wunud-function]
static void ClearErrorState()
^
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for gdal
Running tup.py clean for gdal
Failed to build gdal
Installing collected packages: gdal
Running tup.py install for gdal ... error
ERROR: Complete output from command /home/dennis/miniconda3/bin/python -u -c 'import tuptools, tokenize;__file__='"'"'/tmp/pip-install-i321u6em/gdal/tup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);ad().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.clos  ERROR: running install
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/osr.py build/lib.linux-x86_64-3.7/gdalconst.py build/lib.linux-x86_64-3.7/gdalnumeric.py build/lib.linux-x86_64-3.7/osgeo/gdalconst.py build/lib.linux-x86_64-3.7/osg
Skipping optional fixer: ws_comma
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/osr.py build/lib.linux-x86_64-3.7/gdalconst.py build/lib.linux-x86_64-3.7/gdalnumeric.py build/lib.li
nux-x86_64-3.7/osgeo/gdalconst.py build/lib.linux-x86_64-3.7/osg  Skipping optional fixer: ws_comma
running build_ext
gcc -pthread -B /home/dennis/miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/home/dennis/minicond  gcc -pthread -B /home/dennis/miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/home/dennis/minicond  building 'osgeo._gdal' extension
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/extensions
gcc -pthread -B /home/dennis/miniconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/home/dennis/minicond  cc1plus: warning: command line option ‘-Wstrict-prototypes' is valid for C/ObjC but not for C++
extensions/gdal_wrap.cpp:4075:1: error: ‘VSIDIR' does not name a type
VSIDIR* wrapper_VSIOpenDir( const char * utf8_path,
^
extensions/gdal_wrap.cpp:4123:38: error: ‘VSIDIR' was not declared in this scope
DirEntry* wrapper_VSIGetNextDirEntry(VSIDIR* dir)
^
extensions/gdal_wrap.cpp:4123:46: error: ‘dir' was not declared in this scope
DirEntry* wrapper_VSIGetNextDirEntry(VSIDIR* dir)
^
extensions/gdal_wrap.cpp:4124:1: error: expected ‘,' or ‘;' before ‘{' token
{
绿豆荚
法官工资^
extensions/gdal_wrap.cpp:3225:7: warning: ‘char* get_aligned_buffer(char*, GDALDataType)' defined but not ud [-Wunud-function]
char* get_aligned_buffer(char* data, GDALDataType ntype)
^
extensions/gdal_wrap.cpp:3244:13: warning: ‘void update_buffer_size(void*, char*, char*, size_t)' defined but not ud [-Wunud-function]
static void update_buffer_size(void* obj, char* data, char* data_aligned, size_t buf_size)
^
extensions/gdal_wrap.cpp:3299:5: warning: ‘int GetUExceptions()' defined but not ud [-Wunud-function]
int GetUExceptions() {
^
extensions/gdal_wrap.cpp:3305:6: warning: ‘void UExceptions()' defined but not ud [-Wunud-function]
void UExceptions() {
^
extensions/gdal_wrap.cpp:3322:6: warning: ‘void DontUExceptions()' defined but not ud [-Wunud-function]
void DontUExceptions() {
^
extensions/gdal_wrap.cpp:3370:13: warning: ‘void ClearErrorState()' defined but not ud [-Wunud-function]
static void ClearErrorState()
^
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command "/home/dennis/miniconda3/bin/python -u -c 'import tuptools, tokenize;__file__='"'"'/tmp/pip-install-i321
总结
以上所述是⼩编给⼤家介绍的python安装gdal的两种⽅法,希望对⼤家有所帮助,如果⼤家有任何疑问请给我留⾔,⼩编会及时回复⼤家的。在此也⾮常感谢⼤家对⽹站的⽀持!
如果你觉得本⽂对你有帮助,欢迎转载,烦请注明出处,谢谢!

本文发布于:2023-06-27 16:59:44,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/89/1057478.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:转载   报错   介绍   安装   欢迎   烦请   注明
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图