问题描述
我有一个带有python3包的requirements.txt,该包用于部署使用GDAL的Web应用程序.当我尝试使用pip3 install -r requirements.txt
安装requirements.txt时,由于以下错误而导致失败.我正在使用Centos 7.
I have a requirements.txt with python3 package that is used to deploy a webapp that uses GDAL. When I try to install the requirements.txt using pip3 install -r requirements.txt
, it fails on per the below error. I'm on Centos 7.
我已经尝试过(全部在sudo su-中)
I've tried (all in sudo su -)
pip3 install --upgrade setuptools
pip3 install --upgrade setuptools
pip3下载GDAL
pip3 download GDAL
yum install gdal-devel gcc
yum install gdal-devel gcc
pip3安装GDAL
pip3 install GDAL
错误:
Collecting GDAL
Using cached https://files.pythonhosted.org/packages/99/31/2e05c1be3196126fa04028aed51489f40ceea77e8361a80bc8b00fc463db/GDAL-2.3.1.tar.gz
Complete output from command python setup.py egg_info:
running egg_info
creating pip-egg-info/GDAL.egg-info
writing dependency_links to pip-egg-info/GDAL.egg-info/dependency_links.txt
writing top-level names to pip-egg-info/GDAL.egg-info/top_level.txt
writing pip-egg-info/GDAL.egg-info/PKG-INFO
writing manifest file 'pip-egg-info/GDAL.egg-info/SOURCES.txt'
Traceback (most recent call last):
File "/tmp/pip-install-lriy4brt/GDAL/setup.py", line 153, in fetch_config
p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
File "/usr/lib64/python3.4/subprocess.py", line 856, in __init__
restore_signals, start_new_session)
File "/usr/lib64/python3.4/subprocess.py", line 1464, in _execute_child
raise child_exception_type(errno_num, err_msg)
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-lriy4brt/GDAL/setup.py", line 240, in get_gdal_config
return fetch_config(option, gdal_config=self.gdal_config)
File "/tmp/pip-install-lriy4brt/GDAL/setup.py", line 157, 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-lriy4brt/GDAL/setup.py", line 153, in fetch_config
p = subprocess.Popen([command, args], stdout=subprocess.PIPE)
File "/usr/lib64/python3.4/subprocess.py", line 856, in __init__
restore_signals, start_new_session)
File "/usr/lib64/python3.4/subprocess.py", line 1464, in _execute_child
raise child_exception_type(errno_num, err_msg)
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 "/tmp/pip-install-lriy4brt/GDAL/setup.py", line 435, in <module>
setup(**setup_kwargs)
File "/usr/lib/python3.4/site-packages/setuptools/__init__.py", line 131, in setup
return distutils.core.setup(**attrs)
File "/usr/lib64/python3.4/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib64/python3.4/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib64/python3.4/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 278, in run
self.find_sources()
File "/usr/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 293, in find_sources
mm.run()
File "/usr/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 524, in run
self.add_defaults()
File "/usr/lib/python3.4/site-packages/setuptools/command/egg_info.py", line 560, in add_defaults
sdist.add_defaults(self)
File "/usr/lib/python3.4/site-packages/setuptools/command/py36compat.py", line 36, in add_defaults
self._add_defaults_ext()
File "/usr/lib/python3.4/site-packages/setuptools/command/py36compat.py", line 119, in _add_defaults_ext
build_ext = self.get_finalized_command('build_ext')
File "/usr/lib64/python3.4/distutils/cmd.py", line 299, in get_finalized_command
cmd_obj.ensure_finalized()
File "/usr/lib64/python3.4/distutils/cmd.py", line 107, in ensure_finalized
self.finalize_options()
File "/tmp/pip-install-lriy4brt/GDAL/setup.py", line 290, in finalize_options
self.gdaldir = self.get_gdal_config('prefix')
File "/tmp/pip-install-lriy4brt/GDAL/setup.py", line 246, in get_gdal_config
return fetch_config(option)
File "/tmp/pip-install-lriy4brt/GDAL/setup.py", line 157, in fetch_config
raise gdal_config_error(e)
__main__.gdal_config_error: [Errno 2] No such file or directory: 'gdal-config'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-lriy4brt/GDAL/
推荐答案
对我有帮助
sudo yum install gdal
sudo yum-config-manager --enable epel
sudo yum install gdal-python
您可以在此处找到指向不同操作系统的存储库的链接 https://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries
you can find links to repositories for different os herehttps://trac.osgeo.org/gdal/wiki/DownloadingGdalBinaries
和一些食谱在这里 http://www.enhgo.com/code/pip-install-gdal -linux/
这篇关于pip3 GDAL安装在命令"python setup.py egg_info"上失败失败,错误代码为1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!