Instalação maciça de python impedindo que o Yum seja executado no Redhat

1

Eu estupidamente rm'd /usr/lib/python2.6 ao tentar instalar o 2.7.3 e agora meu sistema está extremamente danificado.

Não consigo executar o yum, o pip ou o easy_install.

O Yum não funciona:

[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 não funciona

[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 não funciona

[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

Eu tentei reinstalar manualmente setuptools novamente (espero que isso possa instalar o 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

O Python 2.7.3 e 2.6.6 funcionam bem no entanto.

Alguma idéia de como corrigir essa situação?

--------- Atualizar ------------ rpm -V yum produz muitos arquivos ausentes, como posso reinstalar esses arquivos?

[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

-------- EDITAR --------------

'resolvido', limpando tudo e fazendo uma nova instalação. Lição aprendida! Não rm -rf coisas que você não entende: P

    
por LittleBobbyTables 27.12.2012 / 23:20

2 respostas

1

Limpa tudo e faz uma nova instalação. Demora muito tempo para reinstalar o yum, easy_install, pip para python2.6 e 2.7

    
por 28.12.2012 / 00:19
0

pkg_resources é fornecido pelo Distribute ou setuptools Conforme anunciado na PyCon 2013, os projetos Distribute e setuptools foram reintegrados. O Distribute agora está obsoleto e você deve usar apenas as novas setuptools atuais. Tente isto:

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

Explicação original aqui: link

    
por 21.03.2014 / 04:15

Tags