pip3在Mac Catalina(10.15)上安装GDAL问题

时间:2020-04-14 11:15:15

标签: python python-3.x gdal python-3.8

我正在尝试在Mac上为python 3安装GDAL模块。到目前为止,我已经尝试了所有在线可用的答案,但是没有任何效果。我已经从http://www.kyngchaos.com/software/frameworks/下载并安装了GDAL框架。然后,我从他们的网站上下载了GDAL 3.0.4,并解压缩到了我的桌面上。之后,我在终端中运行了以下命令:

pip3 install gdal

输出错误:

Collecting gdal
  Using cached GDAL-3.0.4.tar.gz (577 kB)
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/7y/dxr28f990j11vv883_s9n5mr0000gn/T/pip-install-vc9fxh2n/gdal/setup.py'"'"'; __file__='"'"'/private/var/folders/7y/dxr28f990j11vv883_s9n5mr0000gn/T/pip-install-vc9fxh2n/gdal/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/7y/dxr28f990j11vv883_s9n5mr0000gn/T/pip-install-vc9fxh2n/gdal/pip-egg-info
         cwd: /private/var/folders/7y/dxr28f990j11vv883_s9n5mr0000gn/T/pip-install-vc9fxh2n/gdal/
    Complete output (72 lines):
    running egg_info
    creating /private/var/folders/7y/dxr28f990j11vv883_s9n5mr0000gn/T/pip-install-vc9fxh2n/gdal/pip-egg-info/GDAL.egg-info
    writing /private/var/folders/7y/dxr28f990j11vv883_s9n5mr0000gn/T/pip-install-vc9fxh2n/gdal/pip-egg-info/GDAL.egg-info/PKG-INFO
    writing dependency_links to /private/var/folders/7y/dxr28f990j11vv883_s9n5mr0000gn/T/pip-install-vc9fxh2n/gdal/pip-egg-info/GDAL.egg-info/dependency_links.txt
    writing top-level names to /private/var/folders/7y/dxr28f990j11vv883_s9n5mr0000gn/T/pip-install-vc9fxh2n/gdal/pip-egg-info/GDAL.egg-info/top_level.txt
    writing manifest file '/private/var/folders/7y/dxr28f990j11vv883_s9n5mr0000gn/T/pip-install-vc9fxh2n/gdal/pip-egg-info/GDAL.egg-info/SOURCES.txt'
    Traceback (most recent call last):
      File "/private/var/folders/7y/dxr28f990j11vv883_s9n5mr0000gn/T/pip-install-vc9fxh2n/gdal/setup.py", line 151, in fetch_config
        p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 854, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 1702, 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 "/private/var/folders/7y/dxr28f990j11vv883_s9n5mr0000gn/T/pip-install-vc9fxh2n/gdal/setup.py", line 249, in get_gdal_config
        return fetch_config(option, gdal_config=self.gdal_config)
      File "/private/var/folders/7y/dxr28f990j11vv883_s9n5mr0000gn/T/pip-install-vc9fxh2n/gdal/setup.py", line 154, 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 "/private/var/folders/7y/dxr28f990j11vv883_s9n5mr0000gn/T/pip-install-vc9fxh2n/gdal/setup.py", line 151, in fetch_config
        p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 854, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/subprocess.py", line 1702, 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 "<string>", line 1, in <module>
      File "/private/var/folders/7y/dxr28f990j11vv883_s9n5mr0000gn/T/pip-install-vc9fxh2n/gdal/setup.py", line 450, in <module>
        setup(**setup_kwargs)
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/__init__.py", line 145, in setup
        return distutils.core.setup(**attrs)
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 296, in run
        self.find_sources()
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 303, in find_sources
        mm.run()
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 534, in run
        self.add_defaults()
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 570, in add_defaults
        sdist.add_defaults(self)
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/command/sdist.py", line 228, in add_defaults
        self._add_defaults_ext()
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/command/sdist.py", line 311, in _add_defaults_ext
        build_ext = self.get_finalized_command('build_ext')
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 299, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/distutils/cmd.py", line 107, in ensure_finalized
        self.finalize_options()
      File "/private/var/folders/7y/dxr28f990j11vv883_s9n5mr0000gn/T/pip-install-vc9fxh2n/gdal/setup.py", line 311, in finalize_options
        self.gdaldir = self.get_gdal_config('prefix')
      File "/private/var/folders/7y/dxr28f990j11vv883_s9n5mr0000gn/T/pip-install-vc9fxh2n/gdal/setup.py", line 255, in get_gdal_config
        return fetch_config(option)
      File "/private/var/folders/7y/dxr28f990j11vv883_s9n5mr0000gn/T/pip-install-vc9fxh2n/gdal/setup.py", line 154, in fetch_config
        raise gdal_config_error(e)
    __main__.gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

现在我真的很沮丧,因为我需要gdal来完成我的项目,而现在我不能让它工作几个小时。

0 个答案:

没有答案