安装 Ruby on Rails 时出现错误 E:无法纠正问题,您持有损坏的软件包。

安装 Ruby on Rails 时出现错误 E:无法纠正问题,您持有损坏的软件包。

使用的命令:

sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev

输出:

Reading package lists... Done
Building dependency tree
Reading state information... Done
curl is already the newest version.
curl set to manually installed.
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:
build-essential : Depends: g++ (>= 4:4.4.3) but it is not going to be installed
Depends: dpkg-dev (>= 1.13.5) but it is not going to be installed
libcurl4-openssl-dev : Depends: libcurl3 (= 7.35.0-1ubuntu2) but 7.35.0-1ubuntu2.5 is to be installed
Depends: libkrb5-dev but it is not going to be installed
Depends: libldap2-dev but it is not going to be installed
Depends: librtmp-dev but it is not going to be installed
libsqlite3-dev : Depends: libsqlite3-0 (= 3.8.2-1ubuntu2) but 3.8.2-1ubuntu2.1 is to be installed
libssl-dev : Depends: libssl1.0.0 (= 1.0.1f-1ubuntu2) but 1.0.1f-1ubuntu2.15 is to be installed
Recommends: libssl-doc but it is not going to be installed
libxml2-dev : Depends: libxml2 (= 2.9.1+dfsg1-3ubuntu4) but 2.9.1+dfsg1-3ubuntu4.4 is to be installed
sqlite3 : Depends: libsqlite3-0 (= 3.8.2-1ubuntu2) but 3.8.2-1ubuntu2.1 is to be installed
E: Unable to correct problems, you have held broken packages.

屏幕截图

如何解决这个问题。

答案1

尝试一下,它将解决你的依赖问题:

~$ sudo dpkg --force-depends --purge libsqlite3-0:amd64
~$ sudo dpkg --force-depends --purge libsqlite3-0:i386
~$ sudo apt-get update
~$ sudo apt-get install -f
~$ sudo dpkg --configure -a

相关内容