Arch linux:Pacman 无法安装库,因为文件已存在

Arch linux:Pacman 无法安装库,因为文件已存在

我想安装以下库:

  • python-sip
  • pyton-psutil

但是,我收到以下错误:

nakrule@mordor ~ % pacman -S python-psutil 
[sudo] password for nakrule: 
Sorry, try again.
[sudo] password for nakrule: 
resolving dependencies...
looking for conflicting packages...

Packages (1) python-psutil-5.4.7-1

Total Installed Size:  1.95 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                                [----------------------------------] 100%
(1/1) checking package integrity                              [----------------------------------] 100%
(1/1) loading package files                                   [----------------------------------] 100%
(1/1) checking for file conflicts                             [----------------------------------] 100%
error: failed to commit transaction (conflicting files)
python-psutil: /usr/lib/python3.7/site-packages/psutil-5.4.7-py3.7.egg-info/PKG-INFO exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil-5.4.7-py3.7.egg-info/SOURCES.txt exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil-5.4.7-py3.7.egg-info/dependency_links.txt exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil-5.4.7-py3.7.egg-info/not-zip-safe exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil-5.4.7-py3.7.egg-info/top_level.txt exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/__init__.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/__pycache__/__init__.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/__pycache__/_common.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/__pycache__/_compat.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/__pycache__/_exceptions.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/__pycache__/_psaix.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/__pycache__/_psbsd.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/__pycache__/_pslinux.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/__pycache__/_psosx.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/__pycache__/_psposix.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/__pycache__/_pssunos.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/__pycache__/_pswindows.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/_common.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/_compat.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/_exceptions.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/_psaix.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/_psbsd.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/_pslinux.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/_psosx.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/_psposix.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/_pssunos.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/_psutil_linux.cpython-37m-x86_64-linux-gnu.so exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/_psutil_posix.cpython-37m-x86_64-linux-gnu.so exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/_pswindows.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/__init__.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/__main__.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/__pycache__/__init__.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/__pycache__/__main__.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/__pycache__/test_aix.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/__pycache__/test_bsd.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/__pycache__/test_connections.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/__pycache__/test_contracts.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/__pycache__/test_linux.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/__pycache__/test_memory_leaks.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/__pycache__/test_misc.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/__pycache__/test_osx.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/__pycache__/test_posix.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/__pycache__/test_process.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/__pycache__/test_sunos.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/__pycache__/test_system.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/__pycache__/test_unicode.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/__pycache__/test_windows.cpython-37.pyc exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/test_aix.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/test_bsd.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/test_connections.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/test_contracts.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/test_linux.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/test_memory_leaks.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/test_misc.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/test_osx.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/test_posix.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/test_process.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/test_sunos.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/test_system.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/test_unicode.py exists in filesystem
python-psutil: /usr/lib/python3.7/site-packages/psutil/tests/test_windows.py exists in filesystem
Errors occurred, no packages were upgraded.
1 nakrule@mordor ~ % pacman -S python-sip                                                           :(
resolving dependencies...
looking for conflicting packages...

Packages (1) python-sip-4.19.13-1

Total Installed Size:  0.24 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                                [----------------------------------] 100%
(1/1) checking package integrity                              [----------------------------------] 100%
(1/1) loading package files                                   [----------------------------------] 100%
(1/1) checking for file conflicts                             [----------------------------------] 100%
error: failed to commit transaction (conflicting files)
python-sip: /usr/lib/python3.7/site-packages/sip.so exists in filesystem
Errors occurred, no packages were upgraded.

这些文件怎么可能已经存在,我该怎么做才能解决这个问题?

先感谢您。

答案1

pacman将拒绝覆盖它未跟踪的文件,即未在其本地数据库中列出的文件。
此类文件可能是在不使用 的情况下安装的pacman,无论是由您手动安装还是由某个程序代表您安装。

简而言之,如果这些文件不属于任何软件包 - 并且您知道您没有破坏任何内容 - 您可以使用该--overwrite选项安装新软件包,该选项可以pacman绕过文件冲突检查并覆盖冲突文件(请参阅man pacman扩展解释):

# pacman -S --overwrite <glob> package_name

但请注意,ArchWiki警告不要使用 --overwrite(因为它需要一个包含 glob 的参数)。请参阅故障排除相关页面的部分,当前涵盖您的案例。

pacman您可以通过查询的数据库来知道哪个包确实拥有文件(如果有) :

$ pacman -Qo /path/to/file

一种识别方法全部不属于任何包的文件如图所示这一页ArchWiki 的。

相关内容