I can't use yum anymore.

Asked 2 years ago, Updated 2 years ago, 83 views

I am currently using CentOS 6.10.

Regarding the subject, the reason is that I replaced python.
Originally, I used python 2.7.14 and installed python 3.4.10.

When I start yum, I get the following error:

File"/usr/bin/yum", line 30
    except KeyboardInterrupt, e:
                            ^
SyntaxError: invalid syntax

I searched various googles and found that if you rewrite the first line of /usr/bin/yum to the python version you used, you will be able to use it!
However, when I installed python3, I interpreted it as unnecessary and erased python2.

Python 2.7.14 originally downloaded Python-2.7.14.tgz, unzipped, configured, and made & make alt install.
I configured it the same way this time and made & make alt install, but the following error occurred and yum didn't go away.

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 providers this module, or
verify that the module is installed correctly.

It's possible that the above module does not match the
current version of Python, which is:
2.7.14 (default, Oct 13 2019, 07:29:15)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-23)]

If you can't solve this problem yourself, please go to
The yum faq at:
  http://yum.baseurl.org/wiki/Faq

I tried re-entering yum with the following command, but the above error occurred and I have not been able to repair it.

rpm-Uhv -- force http://mirror.centos.org/centos-6/6.10/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm

If you know who it is, please give us guidance.
I don't understand at all, so I have teary eyes.

Thank you for your cooperation.

python centos yum

2022-09-30 20:14

1 Answers

Because Python-2.x and Python-3.x are incompatible, package names and execution commands are also distinguished (both can coexist in standard CentOS packages).

The yum command is intended to work with Python-2.x, so Python-2.x is required.

Python-2.7.14 was also installed from the source code, which is also a source of trouble if you do not install it in a different location from the package-managed directory, such as /usr/local/ or below.

I don't know how you removed the Python-2.x that was originally installed (the yum command should not be easy to remove due to dependencies), but download the package individually from the repository below and
Use the rpm command to specify the installation at the same time.

http://mirror.centos.org/centos/6.10/os/x86_64/Packages/

Possible Packages

python
python-libs
python-setup tools

Specify installation of locally stored packages at the same time

$sudorpm-ivh python*.rpm

Packages and files that are missing due to dependencies may appear as errors, but you must check them one by one and install them with the rpm command.

Adding comments
The above URL is the repository for the latest version of CentOS you are using = 6.10.On the other hand, tkinter-2.6.6-66.el6_8 appears as an error due to dependencies, as of CentOS 6.8, as indicated by .el6_8 at the end.

If you follow the repository URL above, you can see that packages for older update versions are archived at http://vault.centos.org/.
If you dig into the URL as it is, you should be able to reach the following URL.

http://vault.centos.org/6.8/updates/x86_64/Packages/tkinter-2.6.6-66.el6_8.x86_64.rpm


2022-09-30 20:14

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.