2016-05-18 9 views
21

Hier ist meine Sequenz von Befehlszeilen beim Versuch, gdal2.1 in einer virtuellen UBUNTU-Maschine zu installieren. Meine virtuelle Maschine ist ein UBUNTU 16.04 LTS (64bit) Ich würde gdal2.1 und speziell die Python-Bindings benötigen, um damit in Python zu arbeiten. Die aktuell installierte Version von Python ist 2.7.11+ und ich habe numpy installiert, da ich weiß, dass es für GDAL notwendig ist. jetzt die Befehlszeilen mit derPython GDAL 2.1 Installation unter Ubuntu 16.04

Anleitung I in der PyPI Seite von GDAL2.1 gefunden:

[email protected]:~$ sudo apt-get install libgdal1i 

    libgdal1i is already the newest version (1.11.3+dfsg-3build2). 

    [email protected]:~$ sudo apt-get install libgdal1-dev 

    libgdal1-dev is already the newest version (1.11.3+dfsg-3build2). 

    [email protected]:~$ 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/ 

Das war, was ich erhielt. Beachten Sie, dass auf der VM keine andere Software oder Pakete installiert sind. Ich hoffe, dass Sie mir helfen können, GDAL2.1 Verwendung wäre so wichtig ..

ich versucht habe, für einen Vorschlag im GIS-Abschnitt zu fragen, aber ich hatte keine Antworten bisher

Antwort

1

Haben Sie installieren python-dev?

Bevor Sie irgendetwas von der Quelle in Ubuntu installieren, schlage ich vor, Sie kümmern sich um die Build-Abhängigkeiten.

sudo apt-get build-dep python-gdal 

Dann versuchen Sie, die Installation auszuführen.

9

"python-gdal" Version 2.1.0 erfordert gdal Version 2.1.0. So ist die Installation von "libgdal1" Version 1.11.3 nicht ausreichend. Erhalten gdal-2.1.0: http://download.osgeo.org/gdal/2.1.0/gdal-2.1.0.tar.gz

Und die ~ 43 Abhängigkeiten: $ sudo apt-get build-dep gdal

Bau und Installation gdal-2.1.0 und die Python-Bindings:

$ cd gdal-2.1.0/ 
$ ./configure --prefix=/usr/ 
$ make 
$ sudo make install 
$ cd swig/python/ 
$ sudo python setup.py install 

... Keine Probleme hier, mit Ubuntu 16.04 - 64Bits.


+0

Seltsamer verfügbar, ich einen Fehler - 'gdal-2.1.0/.libs/libgdal.so: undefinierter Verweis auf \ 'kmldom :: SerializePretty (boost :: intrusive_ptr const &) '' - notieren Sie den Backtick vor 'kmldom', aber ein einfaches Anführungszeichen nach' const &) ' . Zuvor hatte ich zwei Fehler, weil 'libgdal.so'' png_set_longjmp_fn() 'benötigt, was' libpng' 1.4+ benötigt - die Basisinstallation schien libpng1.2.54 zu sein, und wenn ich 'libpng16-dev' installiert habe, dann die zweite' make' Fehler ging weg .. –

39

Was für mich gearbeitet, ist dies: https://gis.stackexchange.com/a/193828/66527

Unten kopiere ich diese Antwort:

Sie GDAL 2.1 für Windows von GIS Internals herunterladen. Es gibt ein Installationsprogramm und eine portable Version, die keine Installation erfordert.

GDAL 2.1 ist für Ubuntu 16.04 vom UbuntuGIS-Unstable PPA

sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable 
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 

Hinweis Ubuntu 16.04 kommt mit Python 3.5 verwendet aber Python 2.7 als Standard

+3

Funktioniert auch für Ubuntu 14.04. – mrgloom

+1

Es funktionierte für mich für ein Ubuntu17.10 Docker-Bild. –

+0

Amüsant, dass die ursprüngliche gis Antwort hat 12 Stimmen und die kopierte Antwort 33. –