无法在 ubuntu 20.04.2 服务器上安装 libgdal

无法在 ubuntu 20.04.2 服务器上安装 libgdal

这不是“universe repo”的问题,这个帖子是论坛成员建议的我如何启用“Universe”存储库?。这是因为缺少一些依赖,请参阅下面的答案。

如何在 ubuntu 20.04.2 服务器上安装 libgdal?我收到以下错误:

$ sudo apt install libgdal-dev

...
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:
 libgdal-dev : Depends: default-libmysqlclient-dev but it is not going to be installed

以下解决方案对我来说不起作用:

根据@N0rbert 的建议,以下是该命令的输出:

$ apt-cache policy libgdal-dev libmysqlclient-dev default-libmysqlclient-dev
libgdal-dev:
  Installed: 3.0.4+dfsg-1build3
  Candidate: 3.0.4+dfsg-1build3
  Version table:
 *** 3.0.4+dfsg-1build3 500
        500 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/universe amd64 Packages
        500 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages
        100 /var/lib/dpkg/status
libmysqlclient-dev:
  Installed: 8.0.25-0ubuntu0.20.04.1
  Candidate: 8.0.25-0ubuntu0.20.04.1
  Version table:
 *** 8.0.25-0ubuntu0.20.04.1 500
        500 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-updates/main amd64 Packages
        500 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal-security/main amd64 Packages
        100 /var/lib/dpkg/status
     8.0.19-0ubuntu5 500
        500 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 Packages
     5.7.34-1ubuntu18.04 500
        500 http://repo.mysql.com/apt/ubuntu bionic/mysql-5.7 amd64 Packages
default-libmysqlclient-dev:
  Installed: 1.0.5ubuntu2
  Candidate: 1.0.5ubuntu2
  Version table:
 *** 1.0.5ubuntu2 500
        500 https://mirrors.tuna.tsinghua.edu.cn/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status

在此处添加 apt 信息

$ grep -r "^deb" /etc/apt/ --include=*.list
/etc/apt/sources.list.d/mysql.list:deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-apt-config
/etc/apt/sources.list.d/mysql.list:deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-5.7
/etc/apt/sources.list.d/mysql.list:deb http://repo.mysql.com/apt/ubuntu/ bionic mysql-tools
/etc/apt/sources.list.d/mysql.list:deb-src http://repo.mysql.com/apt/ubuntu/ bionic mysql-5.7
/etc/apt/sources.list.d/linuxuprising-ubuntu-libpng12-focal.list:deb http://ppa.launchpad.net/linuxuprising/libpng12/ubuntu focal main
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal universe
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates universe
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal multiverse
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates multiverse
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security universe
/etc/apt/sources.list:deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security multiverse
/etc/apt/sources.list:deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/
/etc/apt/sources.list:deb http://archive.ubuntu.com/ubuntu focal universe

答案1

事实证明,这个库是必需libmysqlclient-devlibgdal,我应该先手动安装它。

$ sudo apt update
$ sudo apt install libmysqlclient-dev
$ sudo apt install libgdal-dev

检查安装:

$ gdalinfo --version
GDAL 3.0.4, released 2020/01/28

相关内容