我一直在互联网上搜索在 CentOS 上安装 yum 的说明。我找不到任何有用的资源,因为所有 yum 软件包的链接都不起作用。
为什么没有一种简单通用的方法来安装 yum,就像使用 pip 安装 python 库一样?
这是我在 CentOS 机器上输入 yum 时收到的错误:
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
No module named yum
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
2.7.14 |Anaconda, Inc.| (default, Mar 27 2018, 17:29:31)
[GCC 7.2.0]
机器规格:
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.4.1708 (Core)
Release: 7.4.1708
Codename: Core
我有两个版本的python:
- /usr/bin/python-->python2.7
- 的输出
which python
是/anaconda/envs/py35/bin/python
我的系统似乎对两个 Python 版本感到困惑。
我的yum
回报/usr/bin/
如下ls /usr/bin/ | grep yum
:
yum
yum-builddep
yum-config-manager
yum-debug-dump
yum-debug-restore
yumdownloader
yum-groups-manager
yum-3.4.3-158.el7.centos.noarch.rpm
当我尝试使用安装 yum 时rpm -i
,出现一大堆冲突错误:
file /usr/lib/python2.7/site-packages/rpmUtils/__init__.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/__init__.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/rpmUtils/arch.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/rpmUtils/miscutils.py from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/rpmUtils/miscutils.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/rpmUtils/oldUtils.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/rpmUtils/transaction.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/rpmUtils/updates.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/Errors.py from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/Errors.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/callbacks.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/comps.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/config.py from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/config.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/constants.py from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/constants.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/depsolve.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/drpm.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/failover.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/fssnapshots.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/history.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/i18n.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/igroups.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/logginglevels.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/mdparser.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/metalink.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/misc.py from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/misc.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/packageSack.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/packages.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/parser.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/pgpmsg.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/pkgtag_db.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/plugins.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/repoMDObject.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/repos.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/rpmsack.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/rpmtrans.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/sqlitesack.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/sqlutils.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/transactioninfo.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/update_md.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/updateinfo.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/yumRepo.py from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/lib/python2.7/site-packages/yum/yumRepo.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/share/yum-cli/yummain.py from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/share/man/man5/yum.conf.5 from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/share/man/man8/yum-shell.8 from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/share/man/man8/yum.8 from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/share/yum-cli/callback.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/share/yum-cli/cli.py from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/share/yum-cli/cli.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/share/yum-cli/output.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/share/yum-cli/shell.py from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/share/yum-cli/shell.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/share/yum-cli/utils.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/share/yum-cli/yumcommands.py from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/share/yum-cli/yumcommands.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
file /usr/share/yum-cli/yummain.pyc from install of yum-3.4.3-158.el7.centos.noarch conflicts with file from package yum-3.4.3-154.el7.centos.noarch
我尝试从、中删除所有yum
相关文件夹,然后使用上述命令重新安装,但出现相同的错误。/usr/bin
/usr/lib/python2.7/site-packages
/usr/share/
答案1
Yum 是 CentOS 的核心部分,我认为不可能拥有它不是已安装。