linux安装错误代码1,gdal安装错误“错误:命令'x86-linux-gnu-gcc'失败,退出状态为1”...

我试图用python安装gdal,但失败了,错误了。

我使用的命令是

pip install GDAL

.

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/usr/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-2.7/extensions/gdal_wrap.o -std=c++11 -I/usr/include/gdal

extensions/gdal_wrap.cpp:3177:27: fatal error: cpl_vsi_error.h: No such file or directory

compilation terminated.

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------

Failed building wheel for GDAL

Running setup.py clean for GDAL

Failed to build GDAL

Installing collected packages: GDAL

Running setup.py install for GDAL ... error

Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-_spRXy/GDAL/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-NxpUaO-record/install-record.txt --single-version-externally-managed --compile:

running install

running build

running build_py

creating build

creating build/lib.linux-x86_64-2.7

copying gdal.py -> build/lib.linux-x86_64-2.7

...

creating build/temp.linux-x86_64-2.7/extensions

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I../../port -I../../gcore -I../../alg -I../../ogr/ -I../../ogr/ogrsf_frmts -I../../gnm -I../../apps -I/usr/include/python2.7 -I/usr/local/lib/python2.7/dist-packages/numpy/core/include -I/usr/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-2.7/extensions/gdal_wrap.o -std=c++11 -I/usr/include/gdal

extensions/gdal_wrap.cpp:3177:27: fatal error: cpl_vsi_error.h: No such file or directory

compilation terminated.

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-_spRXy/GDAL/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-NxpUaO-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-_spRXy/GDAL/

我已经试过了

sudo apt-get install build-essential

但同样的错误也会发生。

根据提供的引用内容,可以看出是在安装gdal2tiles插件时出现了错误错误信息显示是subprocess-exited-with-error,这通常是由于安装过程中出现了问题导致的。解决此问题的方法如下: 1. 确保你的Python环境已经正确安装,并且已经安装了pip工具。 2. 确保你的pip工具是最新版本,可以通过以下命令进行升级: ```shell pip install --upgrade pip ``` 3. 确保你的操作系统已经正确安装GDAL库,可以通过以下命令进行安装: ```shell sudo apt-get install gdal-bin ``` 4. 确保你的操作系统已经正确安装了Python开发包,可以通过以下命令进行安装: ```shell sudo apt-get install python-dev ``` 5. 确保你的操作系统已经正确安装了libgdal-dev库,可以通过以下命令进行安装: ```shell sudo apt-get install libgdal-dev ``` 6. 确保你的操作系统已经正确安装了libproj-dev库,可以通过以下命令进行安装: ```shell sudo apt-get install libproj-dev ``` 7. 确保你的操作系统已经正确安装了libgeos-dev库,可以通过以下命令进行安装: ```shell sudo apt-get install libgeos-dev ``` 8. 确保你的操作系统已经正确安装了libspatialindex-dev库,可以通过以下命令进行安装: ```shell sudo apt-get install libspatialindex-dev ``` 9. 确保你的操作系统已经正确安装了python-gdal库,可以通过以下命令进行安装: ```shell sudo apt-get install python-gdal ``` 10. 确保你的操作系统已经正确安装了python-gdal库的依赖库,可以通过以下命令进行安装: ```shell sudo apt-get install python-numpy python-scipy python-matplotlib ``` 11. 如果以上步骤都已经完成,但是仍然无法解决问题,可以尝试使用conda进行安装,具体方法可以参考以下命令: ```shell conda install -c conda-forge gdal ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值