Error while installing GDAL

2019-03-23 11:40发布

I'm trying to install GDAL through pip. But I'm getting this error:

extensions/gdal_wrap.cpp:3089:27: fatal error: cpl_vsi_error.h: No such     file or directory
 #include "cpl_vsi_error.h"
                           ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I used these commands:

sudo apt-get install libgdal-dev
export CPLUS_INCLUDE_PATH=/usr/include/gdal
export C_INCLUDE_PATH=/usr/include/gdal
pip install GDAL

Can anyone tell me how to install it ?

标签: python pip gdal
2条回答
smile是对你的礼貌
2楼-- · 2019-03-23 11:46

On my MacBook, the update/fresh install of GDAL using this approach with homebrew worked out fine. The problem on my Mac was that I apparently had an old GDAL version installed and wasn't able to update with brew upgrade gdal because of the above error message.

Solution in short:

brew unlink gdal
brew tap osgeo/osgeo4mac && brew tap --repair
brew install jasper netcdf # gdal dependencies
brew install gdal2 --with-armadillo --with-complete --with-libkml --with-unsupported
brew link --force gdal2

Verification:

$> gdal-config --version
2.1.3
$> gdal-config --libs
-L/usr/local/Cellar/gdal2/2.1.3_3/lib -lgdal
$> gdal-config --cflags
-I/usr/local/Cellar/gdal2/2.1.3_3/include
查看更多
Viruses.
3楼-- · 2019-03-23 12:01

Check that you installed GDAL using this command

gdal-config --version

Then run this commands:

pip install --download="some_path" GDAL
cd some_path
tar -xvzf GDAL-<version>.tar.gz
cd GDAL-<version>
python setup.py build_ext --include-dirs=/usr/include/gdal/
python setup.py install
查看更多
登录 后发表回答