Masowo pomieszana instalacja Pythona powstrzymująca Yum przed uruchomieniem w Redhat

1

Głupio rm'd /usr/lib/python2.6, gdy próbuję zainstalować 2.7.3, a teraz mój system jest mocno popieprzony.

Nie mogę uruchomić yum, pip ani easy_install.

Mniam nie działa:

[root@bobby tmp]# 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.3 (default, Dec 28 2012, 15:18:47)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)]

If you cannot solve this problem yourself, please go to
the yum faq at:
  http://yum.baseurl.org/wiki/Faq

easy_install nie działa

[root@bobby tmp]# easy_install
Traceback (most recent call last):
  File "/usr/bin/easy_install", line 5, in <module>
    from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

pip nie działa

[root@bobby tmp]# pip
Traceback (most recent call last):
  File "/usr/bin/pip-python", line 5, in <module>
    from pkg_resources import load_entry_point
ImportError: No module named pkg_resources

Próbowałem ponownie ręcznie zainstalować ponownie setuptools (mam nadzieję, że to może zainstalować pkg_resources ??)

[root@bobby tmp]# sh setuptools-0.6c11-py2.7.egg
Traceback (most recent call last):
  File "<string>", line 1, in <module>
zipimport.ZipImportError: can't decompress data; zlib not available

Python 2.7.3 i 2.6.6 działają jednak dobrze.

Jakieś pomysły na rozwiązanie tej sytuacji?

--------- Aktualizacja ------------ rpm -V yumpowoduje powstanie wielu brakujących plików, jak mogę je ponownie zainstalować?

[root@bobby python2.7]# rpm -V yum
missing     /usr/lib/python2.6/site-packages/rpmUtils
missing     /usr/lib/python2.6/site-packages/rpmUtils/__init__.py
missing     /usr/lib/python2.6/site-packages/rpmUtils/__init__.pyc
missing     /usr/lib/python2.6/site-packages/rpmUtils/__init__.pyo
missing     /usr/lib/python2.6/site-packages/rpmUtils/arch.py
missing     /usr/lib/python2.6/site-packages/rpmUtils/arch.pyc
missing     /usr/lib/python2.6/site-packages/rpmUtils/arch.pyo
missing     /usr/lib/python2.6/site-packages/rpmUtils/miscutils.py
missing     /usr/lib/python2.6/site-packages/rpmUtils/miscutils.pyc
missing     /usr/lib/python2.6/site-packages/rpmUtils/miscutils.pyo
missing     /usr/lib/python2.6/site-packages/rpmUtils/oldUtils.py
missing     /usr/lib/python2.6/site-packages/rpmUtils/oldUtils.pyc
missing     /usr/lib/python2.6/site-packages/rpmUtils/oldUtils.pyo
missing     /usr/lib/python2.6/site-packages/rpmUtils/transaction.py
missing     /usr/lib/python2.6/site-packages/rpmUtils/transaction.pyc
missing     /usr/lib/python2.6/site-packages/rpmUtils/transaction.pyo
missing     /usr/lib/python2.6/site-packages/rpmUtils/updates.py
missing     /usr/lib/python2.6/site-packages/rpmUtils/updates.pyc
missing     /usr/lib/python2.6/site-packages/rpmUtils/updates.pyo
missing     /usr/lib/python2.6/site-packages/yum
missing     /usr/lib/python2.6/site-packages/yum/Errors.py
missing     /usr/lib/python2.6/site-packages/yum/Errors.pyc
missing     /usr/lib/python2.6/site-packages/yum/Errors.pyo
missing     /usr/lib/python2.6/site-packages/yum/__init__.py
missing     /usr/lib/python2.6/site-packages/yum/__init__.pyc
missing     /usr/lib/python2.6/site-packages/yum/__init__.pyo
missing     /usr/lib/python2.6/site-packages/yum/callbacks.py
missing     /usr/lib/python2.6/site-packages/yum/callbacks.pyc
missing     /usr/lib/python2.6/site-packages/yum/callbacks.pyo
missing     /usr/lib/python2.6/site-packages/yum/comps.py
missing     /usr/lib/python2.6/site-packages/yum/comps.pyc
missing     /usr/lib/python2.6/site-packages/yum/comps.pyo
missing     /usr/lib/python2.6/site-packages/yum/config.py
missing     /usr/lib/python2.6/site-packages/yum/config.pyc
missing     /usr/lib/python2.6/site-packages/yum/config.pyo
missing     /usr/lib/python2.6/site-packages/yum/constants.py
missing     /usr/lib/python2.6/site-packages/yum/constants.pyc
missing     /usr/lib/python2.6/site-packages/yum/constants.pyo
missing     /usr/lib/python2.6/site-packages/yum/depsolve.py
missing     /usr/lib/python2.6/site-packages/yum/depsolve.pyc
missing     /usr/lib/python2.6/site-packages/yum/depsolve.pyo
missing     /usr/lib/python2.6/site-packages/yum/failover.py
missing     /usr/lib/python2.6/site-packages/yum/failover.pyc
missing     /usr/lib/python2.6/site-packages/yum/failover.pyo
missing     /usr/lib/python2.6/site-packages/yum/history.py
missing     /usr/lib/python2.6/site-packages/yum/history.pyc
missing     /usr/lib/python2.6/site-packages/yum/history.pyo
missing     /usr/lib/python2.6/site-packages/yum/i18n.py
missing     /usr/lib/python2.6/site-packages/yum/i18n.pyc
missing     /usr/lib/python2.6/site-packages/yum/i18n.pyo
missing     /usr/lib/python2.6/site-packages/yum/logginglevels.py
missing     /usr/lib/python2.6/site-packages/yum/logginglevels.pyc
missing     /usr/lib/python2.6/site-packages/yum/logginglevels.pyo
missing     /usr/lib/python2.6/site-packages/yum/mdparser.py
missing     /usr/lib/python2.6/site-packages/yum/mdparser.pyc
missing     /usr/lib/python2.6/site-packages/yum/mdparser.pyo
missing     /usr/lib/python2.6/site-packages/yum/metalink.py
missing     /usr/lib/python2.6/site-packages/yum/metalink.pyc
missing     /usr/lib/python2.6/site-packages/yum/metalink.pyo
missing     /usr/lib/python2.6/site-packages/yum/misc.py
missing     /usr/lib/python2.6/site-packages/yum/misc.pyc
missing     /usr/lib/python2.6/site-packages/yum/misc.pyo
missing     /usr/lib/python2.6/site-packages/yum/packageSack.py
missing     /usr/lib/python2.6/site-packages/yum/packageSack.pyc
missing     /usr/lib/python2.6/site-packages/yum/packageSack.pyo
missing     /usr/lib/python2.6/site-packages/yum/packages.py
missing     /usr/lib/python2.6/site-packages/yum/packages.pyc
missing     /usr/lib/python2.6/site-packages/yum/packages.pyo
missing     /usr/lib/python2.6/site-packages/yum/parser.py
missing     /usr/lib/python2.6/site-packages/yum/parser.pyc
missing     /usr/lib/python2.6/site-packages/yum/parser.pyo
missing     /usr/lib/python2.6/site-packages/yum/pgpmsg.py
missing     /usr/lib/python2.6/site-packages/yum/pgpmsg.pyc
missing     /usr/lib/python2.6/site-packages/yum/pgpmsg.pyo
missing     /usr/lib/python2.6/site-packages/yum/pkgtag_db.py
missing     /usr/lib/python2.6/site-packages/yum/pkgtag_db.pyc
missing     /usr/lib/python2.6/site-packages/yum/pkgtag_db.pyo
missing     /usr/lib/python2.6/site-packages/yum/plugins.py
missing     /usr/lib/python2.6/site-packages/yum/plugins.pyc
missing     /usr/lib/python2.6/site-packages/yum/plugins.pyo
missing     /usr/lib/python2.6/site-packages/yum/repoMDObject.py
missing     /usr/lib/python2.6/site-packages/yum/repoMDObject.pyc
missing     /usr/lib/python2.6/site-packages/yum/repoMDObject.pyo
missing     /usr/lib/python2.6/site-packages/yum/repos.py
missing     /usr/lib/python2.6/site-packages/yum/repos.pyc
missing     /usr/lib/python2.6/site-packages/yum/repos.pyo
missing     /usr/lib/python2.6/site-packages/yum/rpmsack.py
missing     /usr/lib/python2.6/site-packages/yum/rpmsack.pyc
missing     /usr/lib/python2.6/site-packages/yum/rpmsack.pyo
missing     /usr/lib/python2.6/site-packages/yum/rpmtrans.py
missing     /usr/lib/python2.6/site-packages/yum/rpmtrans.pyc
missing     /usr/lib/python2.6/site-packages/yum/rpmtrans.pyo
missing     /usr/lib/python2.6/site-packages/yum/sqlitesack.py
missing     /usr/lib/python2.6/site-packages/yum/sqlitesack.pyc
missing     /usr/lib/python2.6/site-packages/yum/sqlitesack.pyo
missing     /usr/lib/python2.6/site-packages/yum/sqlutils.py
missing     /usr/lib/python2.6/site-packages/yum/sqlutils.pyc
missing     /usr/lib/python2.6/site-packages/yum/sqlutils.pyo
missing     /usr/lib/python2.6/site-packages/yum/transactioninfo.py
missing     /usr/lib/python2.6/site-packages/yum/transactioninfo.pyc
missing     /usr/lib/python2.6/site-packages/yum/transactioninfo.pyo
missing     /usr/lib/python2.6/site-packages/yum/update_md.py
missing     /usr/lib/python2.6/site-packages/yum/update_md.pyc
missing     /usr/lib/python2.6/site-packages/yum/update_md.pyo
missing     /usr/lib/python2.6/site-packages/yum/yumRepo.py
missing     /usr/lib/python2.6/site-packages/yum/yumRepo.pyc
missing     /usr/lib/python2.6/site-packages/yum/yumRepo.pyo

--------EDYTOWAĆ--------------

„rozwiązany” przez wyczyszczenie wszystkiego i wykonanie nowej instalacji. Wyciągnięta lekcja! Nie rm -rf rzeczy, których nie rozumiesz: P

LittleBobbyTables
źródło

Odpowiedzi:

1

Wyczyściłem wszystko i wykonałem nową instalację. Zbyt czasochłonne jest ponowne instalowanie yum, easy_install, pip zarówno dla python2.6, jak i 2.7

LittleBobbyTables
źródło
1
Czasami usuwanie i ponowna instalacja są najszybsze.
smci
0

pkg_resources jest dostarczane przez Distribute lub setuptools Jak ogłoszono na PyCon 2013, projekty Distribute i setuptools zostały ponownie połączone. Dystrybucja jest teraz przestarzała i powinieneś po prostu użyć nowych aktualnych narzędzi konfiguracyjnych. Spróbuj tego:

curl -O https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
python ez_setup.py

Oryginalne wyjaśnienie tutaj: https://stackoverflow.com/questions/1756721/what-is-causing-importerror-no-module-named-pkg-resources-after-upgrade-of-pyth

doizuc
źródło