如何使用 pacman 强制删除 Arch 中的软件包?

xen*_*ide 75 arch-linux pacman package-management

我如何强制删除 Arch 中的一个包,pacman而其他包仍然依赖它。

pacman -R perl-libwww                                                               
checking dependencies...
error: failed to prepare transaction (could not satisfy dependencies)
:: perl-app-cpanminus: requires perl-libwww>=5.828
:: perl-app-pmuninstall: requires perl-libwww
:: perl-app-sd: requires perl-libwww
:: perl-catalyst-action-rest: requires perl-libwww>=2.033 
:: perl-catalyst-runtime: requires perl-libwww>=1.64
:: perl-cpan: requires perl-libwww
:: perl-cpan-mini: requires perl-libwww
:: perl-cpan-uploader: requires perl-libwww
:: perl-feed-find: requires perl-libwww
:: perl-http-body: requires perl-libwww
:: perl-http-request-ascgi: requires perl-libwww
:: perl-module-cpants-analyse: requires perl-libwww
:: perl-module-install: requires perl-libwww>=5.812
:: perl-net-trac: requires perl-libwww
:: perl-net-whois-raw: requires perl-libwww
:: perl-prophet: requires perl-libwww
:: perl-rt-client-rest: requires perl-libwww
:: perl-uri-fetch: requires perl-libwww
:: perl-www-mechanize: requires perl-libwww
:: perl-xml-atom: requires perl-libwww
:: perl-xml-feed: requires perl-libwww
Run Code Online (Sandbox Code Playgroud)

基本上 LWP 6 拆分了一大堆软件包,我需要将其删除以便重新安装它。

Kam*_*bus 111

您应该能够使用简单的方法重新安装软件包:

# pacman -S perl-libwww
Run Code Online (Sandbox Code Playgroud)

这只会删除 perl-libwww:

# pacman -Rdd perl-libwww
Run Code Online (Sandbox Code Playgroud)

请注意命令中的双-d,如果您使用--nodeps,您也必须指定两次或将其与-d组合,例如:

# pacman -R --nodeps --nodeps perl-libwww
# pacman -Rd --nodeps perl-libwww
Run Code Online (Sandbox Code Playgroud)

这将删除所有依赖于 perl-libwww 的包:

# pacman -Rc perl-libwww
Run Code Online (Sandbox Code Playgroud)

从 pacman 的手册页:

   -d, --nodeps
       Skips dependency version checks. Package names are still
       checked. Normally, pacman will always check a package’s
       dependency fields to ensure that all dependencies are
       installed and there are no package conflicts in the
       system. Specify this option twice to skip all dependency
       checks.
   -c, --cascade
       Remove all target packages, as well as all packages that
       depend on one or more target packages. This operation is
       recursive, and must be used with care since it can remove
       many potentially needed packages.
Run Code Online (Sandbox Code Playgroud)

  • +1 也感谢 -Rc,更多信息在 [Arch Wiki](https://wiki.archlinux.org/index.php/Pacman#Removing_packages) (5认同)