2016-05-18 41 views
21

Đây sẽ là chuỗi các dòng lệnh của tôi trong khi cố gắng cài đặt gdal2.1 trong máy ảo UBUNTU. Máy ảo của tôi là UBUNTU 16.04 LTS (64bit), tôi sẽ cần gdal2.1 và đặc biệt là các ràng buộc Python để làm việc với nó trong python. Phiên bản python hiện được cài đặt là 2.7.11+ và tôi đã cài đặt gọn gàng như tôi biết rằng nó là cần thiết cho GDAL. nay là dòng lệnh vớipython GDAL 2.1 cài đặt trên Ubuntu 16.04

dẫn tôi tìm thấy trong trang Pypi của GDAL2.1:

[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/ 

Đây là những gì tôi thu được. Hãy xem xét rằng VM không cài đặt phần mềm hoặc gói khác. Tôi hy vọng bạn có thể giúp tôi, sử dụng GDAL2.1 sẽ rất quan trọng ..

Tôi đã cố gắng để yêu cầu một số gợi ý trong phần GIS nhưng tôi không có câu trả lời cho đến nay

Trả lời

1

Bạn đã cài đặt python-dev?

Trước khi bạn cài đặt bất kỳ thứ gì từ nguồn trong Ubuntu, tôi khuyên bạn nên quan tâm đến các phụ thuộc xây dựng.

sudo apt-get build-dep python-gdal 

Cố gắng và chạy cài đặt.

9

phiên bản "python-gdal" 2.1.0 yêu cầu phiên bản gdal 2.1.0. Vì vậy, việc cài đặt "libgdal1" phiên bản 1.11.3 là không đủ. Nhận GDAL-2.1.0: bindings $ sudo apt-get build-dep gdal

Xây dựng và lắp đặt GDAL-2.1.0 và Python:: http://download.osgeo.org/gdal/2.1.0/gdal-2.1.0.tar.gz

Và ~ 43 phụ thuộc

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

... Không có vấn đề ở đây, sử dụng Ubuntu 16.04 - 64 bit.


+0

Nhưng kỳ lạ, tôi nhận được một lỗi - 'GDAL-2.1.0/.libs/libgdal.so: undefined tham chiếu đến '' kmldom :: SerializePretty (boost :: intrusive_ptr const &) ''- lưu ý backtick trước' kmldom', nhưng một dấu nháy đơn sau 'const &)' . Trước đây tôi đã có hai lỗi, vì 'libgdal.so' cần' png_set_longjmp_fn() 'yêu cầu' libpng' 1.4+ - cài đặt cơ bản xuất hiện là libpng1.2.54 và khi tôi cài đặt 'libpng16-dev' lần thứ hai' make' lỗi đã biến mất .. –

39

gì làm việc cho tôi là thế này: https://gis.stackexchange.com/a/193828/66527

Dưới đây, tôi sao chép rằng câu trả lời:

Bạn có thể tải GDAL 2.1 dành cho Windows từ GIS Internals. Có một trình cài đặt và một phiên bản di động không yêu cầu cài đặt.

GDAL 2.1 hiện có sẵn cho Ubuntu 16.04 từ 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 

Note Ubuntu 16.04 đi kèm với python 3.5 nhưng sử dụng python 2.7 như mặc định

+3

Hoạt động với Ubuntu 14.04. – mrgloom

+1

Nó làm việc cho tôi cho một hình ảnh docker Ubuntu17.10. –

+0

Vui rằng câu trả lời gốc của gis có 12 phiếu và câu trả lời được sao chép 33. –

Các vấn đề liên quan