[已解决]yum module doesn't match the current version of Python
2018年08月15日 10:35:00 weixin_33762130 阅读数:32
更新了python后,yum无法使用。
-
$ 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.15 |Anaconda, Inc.| (default, May 1 2018, 23:32:55)
-
[GCC 7.2.0]
-
If you cannot solve this problem yourself, please go to
-
the yum faq at:
-
http://yum.baseurl.org/wiki/Faq
看了一下python
-
$ python
-
Python 2.7.15 |Anaconda, Inc.| (default, May 1 2018, 23:32:55)
-
[GCC 7.2.0] on linux2
-
Type "help", "copyright", "credits" or "license" for more information.
-
>>>
我安装的python是anaconda中的python,直接将python替换掉/usr/bin/python,所以
默认的python是conda中的python,导致现在yum的时候会报错。试了一下网上说的修改/usr/bin/yum 中第一行#!/usr/bin/python
的方法,行不通。
看看yum版本
-
$ rpm -q yum
-
yum-3.4.3-154.el7.centos.noarch
image.png
重新装了个python2.6
再将
vi /usr/bin/yum
第一行修改为 /usr/local/bin/python
还没有成功,
重新装yum吧,下载了四个python相关的rpm,重新装一下,
rpm -ivh --force python-tools-2.7.5-68.el7.x86_64.rpm python-2.7.5-68.el7.x86_64.rpm python-libs-2.7.5-68.el7.x86_64.rpm tkinter-2.7.5-68.el7.x86_64.rpm
这里一定要加 --force
参数,
然后yum就可以运行了
+++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++++++++++++++++
From f482660a2a1b9cbe09ea4068c10203b653395858 Mon Sep 17 00:00:00 2001
From: Zaar Hai <haizaar@haizaar.com>
Date: Sun, 29 May 2016 21:10:16 +0000
Subject: [PATCH] python3 - enabled lzma support
---
main/python3/APKBUILD | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/main/python3/APKBUILD b/main/python3/APKBUILD
index 452c032..5e3a067 100644
--- a/main/python3/APKBUILD
+++ b/main/python3/APKBUILD
@@ -4,14 +4,14 @@
pkgname=python3
pkgver=3.5.1
-pkgrel=2
+pkgrel=3
pkgdesc="A high-level scripting language"
url="http://www.python.org"
arch="all"
license="custom"
subpackages="$pkgname-dev $pkgname-doc $pkgname-tests"
depends=""
-makedepends="expat-dev openssl-dev zlib-dev ncurses-dev bzip2-dev
+makedepends="expat-dev openssl-dev zlib-dev ncurses-dev bzip2-dev xz-dev
sqlite-dev libffi-dev tcl-dev linux-headers gdbm-dev readline-dev"
source="http://www.python.org/ftp/python/$pkgver/Python-$pkgver.tar.xz"
--
2.6.6
++++++++++++++++++++++++++++++++++++++++++++