问题
命令:apt-get install libmysqlclient-dev
报错:
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:
libmysqlclient-dev : Depends: zlib1g-dev but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
原因
Linux下经常需要安装不同类型的库,在Ubuntu中,这些类库都是以“lib_name-version”的形式命名的。很多库之间存在依赖关系,即要安装这个就必须安装那个。有时候,类库之间依赖关系无法满足,你所要安装的程序就不能安装。
这类问题大多是由于相互依赖的几个库中一个或多个的版本已经更新,而用户要安装的库依赖于这几个库的较低的版本。
解决
sudo aptitude install < >(尖括号内为你要安装的程序的名字)
aptitude与 apt-get 一样,是 Debian 及其衍生系统中功能极其强大的包管理工具。与 apt-get 不同的是,aptitude在处理依赖问题上更佳一些。举例来说,aptitude在删除一个包时,会同时删除本身所依赖的包。这样,系统中不会残留无用的包,整个系统更为干净。
运行后,不接受未安装方案,接受降级方案,如下图所示:
转自:https://www.cnblogs.com/aaron-agu/p/8862624.html