在帶有 libgdal26 的 Ubuntu 18.04 中安裝 Postgis - 與 libgdal20 不相容?

在帶有 libgdal26 的 Ubuntu 18.04 中安裝 Postgis - 與 libgdal20 不相容?

我已經研究這個問題好幾天了,但還沒有找到解決方案。

我正在嘗試在我的 ubuntu 18.04 機器上安裝 Postgresql-13-postgis-3 。目前我安裝了 Postgresql 13 和 libgdal26 (GDAL 3.0.4); libgdal26 與我的 QGIS 安裝 (3.10) 相容。當我嘗試安裝 Postgis 時,出現以下錯誤:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies.
 postgis : Depends: libgdal20 (>= 2.0.1) but it is not going to be installed
 postgresql-13-postgis-3 : Depends: libgdal20 (>= 2.0.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

因此,然後我嘗試安裝 libgdal20,但它要求刪除許多軟體包,包括 qgis 和 libgdal26 (我需要同時使用 qgis 和 postgis,因此不能刪除 qgis 等)。有沒有辦法使用 gdal 3.x 安裝 postgis ?根據他們的文檔,似乎是這樣,但我的系統不允許我這樣做。其他用戶似乎也有類似的問題(請參閱將 gdal 升級到 3.0.4 後在 ubuntu 18.04 上安裝 postgis)但沒有發布解決方案(我試圖在這篇文章中直接詢問,但按問題被刪除)。

同時,我設法繼續使用 Windows 機器工作。我能夠一次性安裝所有東西並開始工作。到目前為止,ubuntu 中的 GIS 軟體(特別是 qGIS 和 GDAl)由於未滿足的依賴關係而遇到了很多麻煩......甚至讓我考慮切換作業系統!可惜我知道...

任何幫助是極大的讚賞!

答案1

這裡就存在依賴衝突。一種解決方案是等到維護者更新依賴項(或升級到較新的 Ubuntu 20.04 LTS)。

另一個解決方案是從原始碼編譯PostGIS,這不是很複雜。以最新版本的PostGIS為例,您可以:

wget https://download.osgeo.org/postgis/source/postgis-3.1.2.tar.gz
tar xf postgis-3.1.2.tar.gz
cd postgis-3.1.2
./configure
make && sudo make uninstall && sudo make install

然後重新啟動伺服器。

答案2

我有類似的問題。在不必更新作業系統的情況下,我必須:

  1. 刪除發行版cmake並安裝最新的發行版 3.21.3。

  2. CGAL5.3.編譯/安裝

  3. 編譯/安裝1.4(編譯此版本需要SFCGAL最新版本)。cmake

  4. 編譯/更新GEOS到3.8.2。

  5. 安裝以下程式庫:

    sudo apt install protobuf-c-compiler libjsoncpp-dev libprotobuf-dev libprotobuf-c-dev libxml2-dev
    

    這不是完整的依賴項列表,但卻是一個很好的開始。

相關內容