今天最好的部分,我一直在努力让我的头周围如何安装GDAL在我的CentOS 8服务器上。
我已经研究了许多不同的答案和解决方案在不同的网站和整个StackOverflow和似乎没有工作!(我可能在某个地方错过了一些明显的东西)
我正在尝试使用命令pip3 install gdal
安装GDAL
这反过来会产生以下错误:
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.6 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ydh0zt_x/gdal_e96fd73bd85b4e338f6c0fb234dcfaf1/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ydh0zt_x/gdal_e96fd73bd85b4e338f6c0fb234dcfaf1/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-wx20mgo0/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6m/gdal
cwd: /tmp/pip-install-ydh0zt_x/gdal_e96fd73bd85b4e338f6c0fb234dcfaf1/
Complete output (28 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
copying gdal.py -> build/lib.linux-x86_64-3.6
copying ogr.py -> build/lib.linux-x86_64-3.6
copying osr.py -> build/lib.linux-x86_64-3.6
copying gdalconst.py -> build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/osgeo
copying osgeo/__init__.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gdal.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gdal_array.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gdalconst.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/gdalnumeric.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/ogr.py -> build/lib.linux-x86_64-3.6/osgeo
copying osgeo/osr.py -> build/lib.linux-x86_64-3.6/osgeo
running build_ext
Could not run gdal-config!!!!
building 'osgeo._gdal' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/extensions
gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I/usr/include/python3.6m -I. -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-3.6/extensions/gdal_wrap.o
extensions/gdal_wrap.cpp:2813:10: fatal error: cpl_port.h: No such file or directory
#include "cpl_port.h"
^~~~~~~~~~~~
compilation terminated.
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3.6 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ydh0zt_x/gdal_e96fd73bd85b4e338f6c0fb234dcfaf1/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ydh0zt_x/gdal_e96fd73bd85b4e338f6c0fb234dcfaf1/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-wx20mgo0/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6m/gdal Check the logs for full command output.
到目前为止,我已经安装了:
- 项目6
- GEOS
- epel-release(适用于CentOS 8)
- 格达尔利布斯
- PowerTools(我也启用了PowerTools)
我在上面的输出中发现的错误是cpl_port.h: No such file or directory
,我在其他论坛上交叉检查了这个错误,他们建议运行以下命令:sudo apt-get install libgdal-dev
和/或
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
最后,运行pip3 install gdal
命令。
虽然,由于我运行的是CentOS 8,我无法访问"apt-get"
,而是尝试使用"Yum"
,但没有任何运气让上述建议的解决方案工作。
有人能建议或推荐任何解决CentOS 8服务器上cpl_port.h: No such file or directory
错误的方法吗?
非常感谢!:—)
2条答案
按热度按时间nzkunb0c1#
这似乎是CentOS https://bugs.centos.org/view.php?id=18213的一个bug
gdal
需要poppler-0.67
,这是从官方仓库中丢失的。但是它存在于raven-extras
存储库中:https://centos.pkgs.org/8/raven-extras-x86_64/poppler-0.67.0-22.el8.x86_64.rpm.html或者您可以按原样下载它(此处任意命名为
poppler0.67.rpm
),并在安装gdal
时使用它。更新:这个bug似乎已经解决了https://bugzilla.redhat.com/show_bug.cgi?id=1950024
l7wslrjt2#
对于Centos 8 steam gdal安装步骤,我已经用下面的命令解决了依赖性问题。