首页 > 系统相关 >CentOS 安装 GDAL

CentOS 安装 GDAL

时间:2024-08-31 08:55:01浏览次数:9  
标签:CentOS 安装 py GDAL File pip line config gdal

需要离线安装GDAL


(venv) [root@VM-8-12-centos ~]# pip install gdal
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
Collecting gdal
  Downloading http://mirrors.tencentyun.com/pypi/packages/bd/10/85c41cc7c520be9cf755f5862e8c6c8b0c91c8987cb1c706f7092f9893ee/gdal-3.9.2.tar.gz (840 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 840.6/840.6 kB 3.2 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
 
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      Traceback (most recent call last):
        File "/root/MYPROJECT/backend/venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/root/MYPROJECT/backend/venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/root/MYPROJECT/backend/venv/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-mli7azgz/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 332, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
        File "/tmp/pip-build-env-mli7azgz/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 302, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-mli7azgz/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 318, in run_setup
          exec(code, locals())
        File "<string>", line 202, in <module>
      Exception: numpy not available! This error may happen if you build/install using setup.py directly, but should normally not happen if you install using pip install. If you still want to build the bindings without numpy support, define the GDAL_PYTHON_BINDINGS_WITHOUT_NUMPY environment variable
      [end of output]
 
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
(venv) [root@VM-8-12-centos ~]#


(venv) [root@VM-8-12-centos ~]# pip install numpy
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
Requirement already satisfied: numpy in ./MYPROJECT/backend/venv/lib/python3.8/site-packages (1.24.4)


============================================

(venv) [root@VM-8-12-centos ~]# pip install gdal==3.4.3
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
Collecting gdal==3.4.3
  Using cached http://mirrors.tencentyun.com/pypi/packages/12/82/ed7f65fe6ab931514807c79370096a816ad8cad6cef03a2fef90845503f6/GDAL-3.4.3.tar.gz (757 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
 
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [140 lines of output]
      running egg_info
      creating /tmp/pip-pip-egg-info-84igj4c2/GDAL.egg-info
      writing /tmp/pip-pip-egg-info-84igj4c2/GDAL.egg-info/PKG-INFO
      writing dependency_links to /tmp/pip-pip-egg-info-84igj4c2/GDAL.egg-info/dependency_links.txt
      writing requirements to /tmp/pip-pip-egg-info-84igj4c2/GDAL.egg-info/requires.txt
      writing top-level names to /tmp/pip-pip-egg-info-84igj4c2/GDAL.egg-info/top_level.txt
      writing manifest file '/tmp/pip-pip-egg-info-84igj4c2/GDAL.egg-info/SOURCES.txt'
      /root/MYPROJECT/backend/venv/lib/python3.8/site-packages/setuptools/dist.py:478: SetuptoolsDeprecationWarning: Invalid dash-separated options
      !!
      
              ********************************************************************************
              Usage of dash-separated 'index-url' will not be supported in future
              versions. Please use the underscore name 'index_url' instead.
      
              By 2024-Sep-26, you need to update your project and remove deprecated calls
              or your builds will no longer be supported.
      
              See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
              ********************************************************************************
      
      !!
        opt = self.warn_dash_deprecation(opt, section)
      Traceback (most recent call last):
        File "/tmp/pip-install-146bu4z0/gdal_6d483f8c540042a9a0c237df0afd1a01/setup.py", line 105, in fetch_config
          p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
        File "/usr/local/python3/lib/python3.8/subprocess.py", line 858, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "/usr/local/python3/lib/python3.8/subprocess.py", line 1720, in _execute_child
          raise child_exception_type(errno_num, err_msg, err_filename)
      FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/tmp/pip-install-146bu4z0/gdal_6d483f8c540042a9a0c237df0afd1a01/setup.py", line 188, in get_gdal_config
          return fetch_config(option, gdal_config=self.gdal_config)
        File "/tmp/pip-install-146bu4z0/gdal_6d483f8c540042a9a0c237df0afd1a01/setup.py", line 108, in fetch_config
          raise gdal_config_error(e)
      __main__.gdal_config_error: [Errno 2] No such file or directory: '../../apps/gdal-config'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/tmp/pip-install-146bu4z0/gdal_6d483f8c540042a9a0c237df0afd1a01/setup.py", line 105, in fetch_config
          p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
        File "/usr/local/python3/lib/python3.8/subprocess.py", line 858, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "/usr/local/python3/lib/python3.8/subprocess.py", line 1720, in _execute_child
          raise child_exception_type(errno_num, err_msg, err_filename)
      FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/tmp/pip-install-146bu4z0/gdal_6d483f8c540042a9a0c237df0afd1a01/setup.py", line 195, in get_gdal_config
          return fetch_config(option)
        File "/tmp/pip-install-146bu4z0/gdal_6d483f8c540042a9a0c237df0afd1a01/setup.py", line 108, in fetch_config
          raise gdal_config_error(e)
      __main__.gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-146bu4z0/gdal_6d483f8c540042a9a0c237df0afd1a01/setup.py", line 389, in <module>
          setup(**setup_kwargs)
        File "/root/MYPROJECT/backend/venv/lib/python3.8/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
        File "/root/MYPROJECT/backend/venv/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 184, in setup
          return run_commands(dist)
        File "/root/MYPROJECT/backend/venv/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 200, in run_commands
          dist.run_commands()
        File "/root/MYPROJECT/backend/venv/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/root/MYPROJECT/backend/venv/lib/python3.8/site-packages/setuptools/dist.py", line 976, in run_command
          super().run_command(command)
        File "/root/MYPROJECT/backend/venv/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/root/MYPROJECT/backend/venv/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 321, in run
          self.find_sources()
        File "/root/MYPROJECT/backend/venv/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 329, in find_sources
          mm.run()
        File "/root/MYPROJECT/backend/venv/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 550, in run
          self.add_defaults()
        File "/root/MYPROJECT/backend/venv/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 588, in add_defaults
          sdist.add_defaults(self)
        File "/root/MYPROJECT/backend/venv/lib/python3.8/site-packages/setuptools/command/sdist.py", line 102, in add_defaults
          super().add_defaults()
        File "/root/MYPROJECT/backend/venv/lib/python3.8/site-packages/setuptools/_distutils/command/sdist.py", line 250, in add_defaults
          self._add_defaults_ext()
        File "/root/MYPROJECT/backend/venv/lib/python3.8/site-packages/setuptools/_distutils/command/sdist.py", line 334, in _add_defaults_ext
          build_ext = self.get_finalized_command('build_ext')
        File "/root/MYPROJECT/backend/venv/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 303, in get_finalized_command
          cmd_obj.ensure_finalized()
        File "/root/MYPROJECT/backend/venv/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 111, in ensure_finalized
          self.finalize_options()
        File "/tmp/pip-install-146bu4z0/gdal_6d483f8c540042a9a0c237df0afd1a01/setup.py", line 258, in finalize_options
          self.gdaldir = self.get_gdal_config('prefix')
        File "/tmp/pip-install-146bu4z0/gdal_6d483f8c540042a9a0c237df0afd1a01/setup.py", line 201, in get_gdal_config
          raise gdal_config_error(traceback_string + '\n' + msg)
      __main__.gdal_config_error: Traceback (most recent call last):
        File "/tmp/pip-install-146bu4z0/gdal_6d483f8c540042a9a0c237df0afd1a01/setup.py", line 105, in fetch_config
          p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
        File "/usr/local/python3/lib/python3.8/subprocess.py", line 858, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "/usr/local/python3/lib/python3.8/subprocess.py", line 1720, in _execute_child
          raise child_exception_type(errno_num, err_msg, err_filename)
      FileNotFoundError: [Errno 2] No such file or directory: '../../apps/gdal-config'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/tmp/pip-install-146bu4z0/gdal_6d483f8c540042a9a0c237df0afd1a01/setup.py", line 188, in get_gdal_config
          return fetch_config(option, gdal_config=self.gdal_config)
        File "/tmp/pip-install-146bu4z0/gdal_6d483f8c540042a9a0c237df0afd1a01/setup.py", line 108, in fetch_config
          raise gdal_config_error(e)
      gdal_config_error: [Errno 2] No such file or directory: '../../apps/gdal-config'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/tmp/pip-install-146bu4z0/gdal_6d483f8c540042a9a0c237df0afd1a01/setup.py", line 105, in fetch_config
          p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
        File "/usr/local/python3/lib/python3.8/subprocess.py", line 858, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "/usr/local/python3/lib/python3.8/subprocess.py", line 1720, in _execute_child
          raise child_exception_type(errno_num, err_msg, err_filename)
      FileNotFoundError: [Errno 2] No such file or directory: 'gdal-config'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/tmp/pip-install-146bu4z0/gdal_6d483f8c540042a9a0c237df0afd1a01/setup.py", line 195, in get_gdal_config
          return fetch_config(option)
        File "/tmp/pip-install-146bu4z0/gdal_6d483f8c540042a9a0c237df0afd1a01/setup.py", line 108, in fetch_config
          raise gdal_config_error(e)
      gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
      
      Could not find gdal-config. Make sure you have installed the GDAL native library and development headers.
      [end of output]
 
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
(venv) [root@VM-8-12-centos ~]#


============================================

linux安装python的GDAL包时,总是出现如下错误:
gdal_config_error: [Errno 2] No such file or directory: ‘gdal-config’
Could not find gdal-config. Make sure you have installed the GDAL native library and development headers.

查了许多资料,都不行。
索性改变思路,去找linux下python的轮子,还真就找到了

linux下python的GDAL轮子链接如下:
https://sourceforge.net/projects/gdal-wheels-for-linux/files/

但是只有3.6、3.7版本的python轮子,因此需要重新下载3.6或者3.7版本的python,linux下安装python请参考其他博文。

下载好轮子之后,python -m pip install 轮子.wheel
链接:https://blog.csdn.net/qq_36181130/article/details/121519519


============================================

离线安装GDAL


https://sourceforge.net/projects/gdal-wheels-for-linux/files/

 GDAL-3.4.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl     2022-02-03     76.0 MB     
42
GDAL-3.4.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl     2022-02-03     76.0 MB     
64
GDAL-3.4.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl     2022-02-03     76.1 MB     
4
GDAL-3.4.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl     2022-02-03     76.1 MB     
3
GDAL-3.1.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.whl     2021-05-13     70.3 MB     
45
GDAL-3.1.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl     2021-05-13     70.3 MB     


(venv) [root@VM-8-12-centos software]#  pip install GDAL-3.4.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
Processing ./GDAL-3.4.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Requirement already satisfied: numpy>=1.21.3 in /root/MYPROJECT/backend/venv/lib/python3.8/site-packages (from GDAL==3.4.1) (1.24.4)
Installing collected packages: GDAL
Successfully installed GDAL-3.4.1
(venv) [root@VM-8-12-centos software]#


============================================


 

标签:CentOS,安装,py,GDAL,File,pip,line,config,gdal
From: https://www.cnblogs.com/emanlee/p/18389806

相关文章

  • .Net 5.0 WebAPI 发布至 CentOS 7 系统
    〇、前言本文主要介绍了在CentOS7上部署WebAPI项目的过程。先安装.net5.0的环境,再创建一个示例项目并发布至CentOS上,同时列明了一些注意的点;最后将dotnet命令添加到系统自启动服务。一、Linux环境准备1.1centos7.x在线安装.net5.0第一行命令是添加包源,第二......
  • 使用docker安装mysql
    安装Docker1、Docker教程地址:https://www.runoob.com/docker/centos-docker.install.html2、安装docker命令:yuminstalldocker-io3、启动docker命令:servicedockerstart4、查看docker是否启动成功命令:ps-ef|grepdocker使用docker安装mysql1、查询mysql命令:docke......
  • CentOS7 官网停更后的补救措施
    问题一:无法正常使用yum命令。问题描述:终端执行yum-yupdate,报以下错误提示:Couldnotretrievemirrorlisthttp://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock32errorwas14:curl#6-"Couldnotresolvehost:mirrorlist.centos.org;Unknown......
  • 一个linux服务器安装多个java版本,如何选择指定的 java版本去执行
    linux中有时候可能你由于不同的项目需要使用不同版本的javajdk部署,你就需要在你的linux服务中安装很多个版本的javajdk,那么在linux中如何安装和使用不同版本的javajdk呢?1.安装第一个javajdk版本:到java官网下载一个javajdk版本,并解压,然后配置环境变量。javajdk地址:wge......
  • Adobe Photoshop (ps2024)软件win/mac下载安装
    一、软件简介1.1产品背景AdobePhotoshop(简称PS)是Adobe公司旗下最为著名的图像处理软件之一,自问世以来,一直受到广大平面设计人员、摄影师、艺术家及电脑美术爱好者的青睐。Photoshop以其强大的图像扫描、编辑修改、图像制作、广告创意及图像输入输出功能而闻名,是图形图像处......
  • Adobe Premiere Pro(PR2024)软件下载安装win/mac
    一、软件概述1.1简介AdobePremierePro(简称PR)是Adobe公司开发的一款专业视频编辑软件,广泛应用于电影、电视、广告、社交媒体内容的后期制作中。它以其强大的编辑功能、高效的工作流程和广泛的兼容性而闻名,支持从高清到4K甚至更高分辨率的视频编辑。1.2主要特点高效编辑......
  • Adobe Photoshop(PS2024)软件win/mac下载安装
    一、软件概述1.软件背景AdobePhotoshop(简称PS)是AdobeSystems公司开发并发行的一款强大的图像处理软件,自1990年首次发布以来,便迅速成为数字图像处理和图形设计的行业标准。Photoshop不仅支持图像扫描、编辑修改、图像制作、广告创意,还集图像输入与输出于一体,是平面设计师、......
  • 专业视频编辑软件Adobe Premiere Pro(PR2024)win/mac软件安装下载
    一、软件概述1.1简介AdobePremierePro(简称PR)是Adobe公司开发的一款专业视频编辑软件,广泛应用于电影、电视、广告、网络视频等领域。它提供了强大的视频剪辑、调色、音频处理、效果添加及多轨编辑等功能,能够满足从初学者到专业影视制作人员的不同需求。1.2主要特点高性......
  • 三维建模动画设计C4D mac软件下载_绿色安装包+安装步骤
    我们目前生活在一个抛弃平面化设计风格向复杂的立体、运动效果转变的世界。如此,你需要一款始终能针对市场需求调整的软件,这就是CINEMA4D能带给你的。如果你正在准备为你的个人或企业设计一个站点,那么你必须考虑使用CINEMA4D来创造令人惊艳的官网效果。这里有着各种反射和......
  • pip install gdal 在Windows系统上安装gdal
     django.core.exceptions.ImproperlyConfigured:CouldnotfindtheGDALlibrary(tried"gdal302","gdal301","gdal300","gdal204","gdal203","gdal202","gdal201","gdal20").Is......