我想安装最新版本的博托,我通过python setup.py install
然而,当我尝试删除旧版本时,以下软件包也会被删除:
apt-get remove python-boto
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
cloud-init cloud-utils euca2ools python-boto
我怎样才能告诉包管理器删除 boto,然后将其标记为外部安装(或类似的东西),以便 apt 不会尝试修复丢失的依赖项?
答案1
直接使用 dpkg,而不是 apt-get 或 aptitude:
sudo dpkg -r --force-depends "packagename-version"
或者
sudo dpkg -r --force-depends "packagename"
答案2
我知道这是一篇老帖子,但由于我最近遇到了类似的问题,所以我想分享我的解决方案,希望将来有人会发现它有用。
如果您通过 aptitude 安装了一个软件包,它会自动为依赖项分配标志(自动),当您再次尝试删除软件包时,它会尝试删除所有仍设置了自动标志的依赖项。
正如你所看到的,在我的例子中,我想要删除的是 zabbix:
uman@mango:~$ sudo aptitude purge zabbix-server-mysql zabbix-frontend-php
The following packages will be REMOVED:
apache2{u} dbconfig-common{u} fping{u} javascript-common{u} libhtml-template-perl{u} libiksemel3{u} libjs-prototype{u}
libjs-scriptaculous{u} libopenipmi0{u} libt1-5{u} mysql-server{u} mysql-server-5.1{u} mysql-server-core-5.1{u} php5{u} php5-gd{u}
php5-mysql{u} snmpd{u} wwwconfig-common{u} zabbix-frontend-php{p} zabbix-server-mysql{p}
0 packages upgraded, 0 newly installed, 20 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 44.9 MB will be freed.
Do you want to continue? [Y/n/?]
如果我们查看 apache 包,它看起来像这样
uman@mango:~$ aptitude search ^apache2
i A apache2 - Apache HTTP Server metapackage
<snip>
第一个标志“i”告诉我们 apache 已安装,
下一个标志“A”代表自动安装
因此,为了修复此问题并且不卸载 apache、mysql 和 php,我们可以使用 aptitude 删除自动标志,如下所示:
uman@mango:~$ sudo aptitude unmarkauto apache2 mysql-server php5
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
现在删除 zabbix 包时看起来是这样的:
uman@mango:~$ sudo aptitude purge zabbix-server-mysql zabbix-frontend-php
The following packages will be REMOVED:
dbconfig-common{u} fping{u} javascript-common{u} libiksemel3{u} libjs-prototype{u} libjs-scriptaculous{u} libopenipmi0{u} libt1-5{u}
php5-gd{u} wwwconfig-common{u} zabbix-frontend-php{p} zabbix-server-mysql{p}
0 packages upgraded, 0 newly installed, 12 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 16.6 MB will be freed.
Do you want to continue? [Y/n/?]
请查看 aptitude 的手册页以了解更多详细信息
答案3
您可以使用实用程序创建一个虚拟 .deb 包equivs
,它将提供依赖项而不安装任何文件。然后只需使用 将当前安装的包替换为虚拟版本即可dpkg -i fake.deb
。
答案4
据我所知,无法使用 APT 删除一个软件包而不删除依赖于该软件包的软件包。
参考:http://www.debian.org/doc/manuals/apt-howto/ch-apt-get.en.html