在Ubuntu 16.04上安装python GDAL 2.1 [英] python GDAL 2.1 installation on Ubuntu 16.04
问题描述
这是我尝试在UBUNTU虚拟机中安装gdal2.1时的命令行顺序.我的虚拟机是UBUNTU 16.04 LTS(64bit),我需要gdal2.1,尤其是Python绑定才能在python中使用它.当前安装的python版本是2.7.11+,我安装了numpy,因为我知道这对于GDAL是必需的.现在,带有
Here will be my sequence of command lines while trying to install gdal2.1 in a UBUNTU virtual machine. My virtual machine is a UBUNTU 16.04 LTS(64bit) I would need gdal2.1 and especially the Python bindings to work with it in python. The versionof python currently installed is 2.7.11+ and I installed numpy as I know that it is necessary for GDAL. now the command lines with the
我在GDAL2.1的Pypi页面中找到的说明:
Instructions I found in the Pypi page of GDAL2.1:
antonio19812@antonio19812-VirtualBox:~$ sudo apt-get install libgdal1i
libgdal1i is already the newest version (1.11.3+dfsg-3build2).
antonio19812@antonio19812-VirtualBox:~$ sudo apt-get install libgdal1-dev
libgdal1-dev is already the newest version (1.11.3+dfsg-3build2).
antonio19812@antonio19812-VirtualBox:~$ sudo pip install gdal
Collecting gdal Downloading GDAL-2.1.0.tar.gz (619kB) 100% |████████████████████████████████| 624kB 247kB/s
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-_sHDUY/gdal/setup.py';
exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n',
'\n'), file, 'exec'))" install --record /tmp/pip-eOB65J-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
copying ogr.py -> build/lib.linux-x86_64-2.7
copying osr.py -> build/lib.linux-x86_64-2.7
copying gdalconst.py -> build/lib.linux-x86_64-2.7
copying gdalnumeric.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/osgeo
copying osgeo/gdal.py -> build/lib.linux-x86_64-2.7/osgeo
copying osgeo/gdalconst.py -> build/lib.linux-x86_64-2.7/osgeo
copying osgeo/osr.py -> build/lib.linux-x86_64-2.7/osgeo
copying osgeo/__init__.py -> build/lib.linux-x86_64-2.7/osgeo
copying osgeo/ogr.py -> build/lib.linux-x86_64-2.7/osgeo
copying osgeo/gdal_array.py -> build/lib.linux-x86_64-2.7/osgeo
copying osgeo/gnm.py -> build/lib.linux-x86_64-2.7/osgeo
copying osgeo/gdalnumeric.py -> build/lib.linux-x86_64-2.7/osgeo
running build_ext
building 'osgeo._gdal' extension
creating build/temp.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 -Wstrict-prototypes -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
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
extensions/gdal_wrap.cpp:3085:22: fatal error: cpl_port.h: File o directory non
esistente
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-_sHDUY/gdal/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record /tmp/pip-eOB65J-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-_sHDUY/gdal/
这就是我所获得的.考虑虚拟机未安装其他软件或软件包.希望您能对我有所帮助,使用GDAL2.1非常重要.
This was what I obtained. Consider that the VM has not other software or packages installed. I hope you can help me, using GDAL2.1 would be so important..
我试图在GIS部分寻求一些建议,但到目前为止我还没有答案
I have tried to ask for some suggestion in the GIS section but I had no answers so far
推荐答案
对我有用的是: https://gis.stackexchange.com/a/193828/66527
下面,我复制该答案:
您可以从 GIS内部构件下载Windows版GDAL 2.1.有不需要安装的安装程序和便携式版本.
You can download GDAL 2.1 for Windows from GIS Internals. There is an installer and a portable version that doesn't require installation.
sudo add-apt-repository -y ppa:ubuntugis/ppa
sudo apt update
sudo apt upgrade # if you already have gdal 1.11 installed
sudo apt install gdal-bin python-gdal python3-gdal # if you don't have gdal 1.11 already installed
注意Ubuntu 16.04随附python 3.5,但使用python 2.7作为默认
Note Ubuntu 16.04 comes with python 3.5 but uses python 2.7 as default
这篇关于在Ubuntu 16.04上安装python GDAL 2.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!