curl在Ubuntu 18.04 LTS上不起作用


39

我无法使用curl从网络上获取内容。我试图将其安装在下面。

无法安装某些软件包。这可能意味着您请求了一种不可能的情况,或者如果您使用的不稳定发行版中尚未创建某些必需的软件包或将其从“传入”中移出。以下信息可能有助于解决该情况:

以下软件包具有未满足的依赖性。curl:取决于:libcurl4(= 7.58.0-2ubuntu3)但不会被安装E:无法纠正问题,您拿着损坏的包装。

我检查了既保持封装sudo apt-mark showhelddpkg -l | grep ^h在得到手持包的列表的希望,但我没有得到任何结果,无论哪种方式。

另外,当我尝试安装libcurl4它时,几乎会破坏我的系统,因为它尝试删除下面的这些软件包。

libcurl3 mongodb-enterprise mongodb-enterprise-server mongodb-enterprise-tools msodbcsql msodbcsql17 mssql-tools php7.1-curl r-base r-base-core r-base-dev r-base-html r-cran-boot r-cran类r-cran-codetools r-cran-外国r-cran-getopt r-cran-kernsmooth r-cran-lattice r-cran-littler r-cran-mass r-cran-matrix r-cran-mgcv r-cran -nlme r-cran-nnet r-cran-rpart r-cran-spatial r-cran-survival r-recommended slack-desktop virtualbox-5.2

编辑

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution. deb http://gb.archive.ubuntu.com/ubuntu/ bionic main restricted deb-src
http://gb.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution. deb http://gb.archive.ubuntu.com/ubuntu/ bionic-updates main restricted deb-src
http://gb.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team. deb http://gb.archive.ubuntu.com/ubuntu/ bionic universe deb-src
http://gb.archive.ubuntu.com/ubuntu/ bionic universe

deb http://gb.archive.ubuntu.com/ubuntu/ bionic-updates universe
deb-src http://gb.archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team. deb http://gb.archive.ubuntu.com/ubuntu/ bionic multiverse deb-src http://gb.archive.ubuntu.com/ubuntu/ bionic
multiverse

deb http://gb.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb-src http://gb.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users. deb http://archive.canonical.com/ubuntu bionic partner deb-src
http://archive.canonical.com/ubuntu bionic partner

deb http://security.ubuntu.com/ubuntu bionic-security main restricted
deb-src http://security.ubuntu.com/ubuntu bionic-security main
restricted

deb http://security.ubuntu.com/ubuntu bionic-security universe deb-src
http://security.ubuntu.com/ubuntu bionic-security universe

deb http://security.ubuntu.com/ubuntu bionic-security multiverse
deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse

deb http://gb.archive.ubuntu.com/ubuntu/ bionic-proposed main
multiverse universe restricted #Not for humans during development
stage of release bionic
# ded-src http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted ui=niverse

deb http://gb.archive.ubuntu.com/ubuntu/ bionic-backports main
restricted multiverse universe

首先执行sudo apt-get update然后执行以下命令:dpkg -l | grep ^..r并将输出添加到您的问题
Hee Jin

更新运行良好,但仍然没有输出dpkg -l | grep ^..r
Joseph-LS

尝试sudo apt-get -s -o Debug::pkgProblemResolver=yes install libcurl4 将输出添加到您的问题中
Hee Jin

另外,请编辑您的问题以包括cat /etc/apt/sources.list
Hee Jin

sudo apt-get -s -o Debug::pkgProblemResolver=yes install libcurl4运行无故障,并指示libcurl4 is already the newest version(7.58.0-2ubuntu3)。那是因为我对系统进行了一些更改。我发现,实际上是特定的软件包需要较早版本的libcurl e.g. 3php7.2libcurl4随附的Ubuntu 18.04 LTS会自动安装。但是在安装了libcurl3的情况下,我无法安装curl。因此,我最终备份了一些数据,放开所有无关紧要的内容,然后使用重新安装软件包libcurl4 & curl
约瑟夫·LS

Answers:


30

这个问题在ubuntu最近的LTS中的多个软件包中很常见。预安装的软件包在版本约定中可能会出现错误,因为引用“ repo”的“ 18.04”和其他字符串被视为软件包版本的一部分,而不是对repo的引用。
解决方法是先卸载预安装的依赖项,然后重新安装。之后,您可以安装cURL。

apt remove -y libcurl4
apt install -y libcurl4 curl

出现此问题的其他软件包是okular和libsdl2,解决方案是相同的,跟踪有问题的依赖项,删除并重新安装。

此外,您可以使用apt 降级机制(因此,不必卸载依赖于libcurl4的软件包)。

apt install -y libcurl4=7.58.0-2ubuntu3
apt install -y curl

1

从源安装curl。那对我有用。

git clone https://github.com/curl/curl.git
cd curl
./buildconf
./configure
make
make test # optional
sudo make install

0

尝试使用

sudo apt install libcurl4-openssl-dev

如有需要

sudo update
sudo apt remove libcurl4
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.