无法导入osgeo和GDAL库

时间:2017-07-24 10:07:49

标签: python gdal osgeo

我需要python代码中的osgeo和GDAL库。所以,我导入它们并编译以检查它们是否已安装(我不是python专家),并且正如预期的那样,库不存在。所以,我尝试使用pycharm设置工具安装它。

对于 osgeo ,我发现了两种可能性。

  • Django的OSGEO-进口商。
  • Django的OSGEO-进口商客户端。

并且安装成功。但对于GDAL我有一个错误(见图)。 pycharm error window

我还尝试从终端安装GDAL,我也遇到了这个错误:

anoir@anoir-Lenovo-IdeaPad-Y510P:~$ sudo -H pip install GDAL
Collecting GDAL
  Using cached GDAL-2.2.1.tar.gz
  Complete output from command python setup.py egg_info:
  running egg_info
  creating pip-egg-info/GDAL.egg-info
  writing pip-egg-info/GDAL.egg-info/PKG-INFO
  writing top-level names to pip-egg-info/GDAL.egg-info/top_level.txt
  writing dependency_links to pip-egg-info/GDAL.egg-info/dependency_links.txt
  writing manifest file 'pip-egg-info/GDAL.egg-info/SOURCES.txt'
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-5IPiZv/GDAL/setup.py", line 339, in <module>
    **extra )
    File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
    File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
    File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 280, in run
    self.find_sources()
    File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 295, in find_sources
    mm.run()
    File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 526, in run
    self.add_defaults()
    File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 562, in add_defaults
    sdist.add_defaults(self)
    File "/usr/local/lib/python2.7/dist-packages/setuptools/command/py36compat.py", line 36, in add_defaults
    self._add_defaults_ext()
    File "/usr/local/lib/python2.7/dist-packages/setuptools/command/py36compat.py", line 119, in _add_defaults_ext
    build_ext = self.get_finalized_command('build_ext')
    File "/usr/lib/python2.7/distutils/cmd.py", line 312, in get_finalized_command
    cmd_obj.ensure_finalized()
    File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized
    self.finalize_options()
    File "/tmp/pip-build-5IPiZv/GDAL/setup.py", line 214, in finalize_options
    self.gdaldir = self.get_gdal_config('prefix')
    File "/tmp/pip-build-5IPiZv/GDAL/setup.py", line 188, in get_gdal_config
    return fetch_config(option)
    File "/tmp/pip-build-5IPiZv/GDAL/setup.py", line 141, in fetch_config
    raise gdal_config_error, e""")
    File "<string>", line 4, in <module>
__main__.gdal_config_error: [Errno 2] No such file or directory

----------------------------------------
Command "python setup.by egg_info" failed with error code 1 in /tmp/pip-build-5IPiZv/GDAL/

所以我尝试按照本教程Installing GDAL/OGR on Ubuntu进行操作,但是当我编译脚本时,同样的问题仍然存在。

有什么想法吗?

0 个答案:

没有答案