
我正在嘗試按照以下方式在 Ubuntu 18.04 下安裝適用於 python 3.6.9 的 GDAL:https://pypi.org/project/GDAL/ 我嘗試了這兩種方法:'easy_install''''sudo easy_install GDAL'''和'setup.py''''python setup.py build &&python setup.py install'''。
但他們都失敗了。這是當我使用 '''sudo easy_install GDAL''' 時返回給我的信息:
Extensions/gdal_wrap.cpp:3209:9: 錯誤:「GDALExtendedDataTypeHS」未命名型別;您指的是「GDALFindDataType」嗎? typedef GDAL擴充資料類型HS GDAL擴充資料類型HS; ^~~~~~~~~~~~~~~~~~~~~~ GDAFindDataType
…
擴展/gdal_array_wrap.cpp:5771:51:錯誤:在“*”標記之前預期有“(”擴展/gdal_array_wrap.cpp:5771:53:錯誤:在“>”標記之前預期有主表達式arg8 = reinterpret_cast< GDALExtendedDataTypeHS * >( argp8); ^ extensions/gdal_array_wrap.cpp:5771:61: 錯誤: ';' 之前應有 ')'令牌 arg8 = reinterpret_cast< GDALExtendedDataTypeHS * >(argp8); ^
錯誤:安裝腳本退出並出現錯誤:指令「x86_64-linux-gnu-gcc」失敗,退出狀態為 1
如何正確安裝 GDAL?
答案1
您可以從以下位置安裝帶有 Python 綁定的 GDAL儲存庫使用:
sudo apt-get install python3-gdal python-gdal libgdal-dev