1

Я тупо rm'd /usr/lib/python2.6 при попытке установить 2.7.3 и теперь моя система сильно испорчена.

Я не могу запустить yum, pip или easy_install.

Yum не работает:

[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 не работает

[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

Пип не работает

[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

Я попытался вручную переустановить setuptools снова (надеюсь, это может установить 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 и 2.6.6 работают нормально.

Есть идеи, как исправить эту ситуацию?

--------- Обновление ------------ rpm -V yum создает много отсутствующих файлов, как я могу переустановить их?

[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

--------РЕДАКТИРОВАТЬ--------------

'решено', вытирая все и делая новую установку. Урок выучен! Не думай о вещах, которые ты не понимаешь:P

2 ответа2

1

Вытер все и сделал новую установку. Слишком много времени для переустановки yum, easy_install, pip для python2.6 и 2.7

0

pkg_resources предоставляется либо Distribute, либо setuptools. Как было объявлено на PyCon 2013, проекты Distribute и setuptools были объединены. Распространение теперь устарело, и вы должны просто использовать новые текущие настройки. Попробуй это:

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

Оригинальное объяснение здесь:https://stackoverflow.com/questions/1756721/what-is-causing-importerror-no-module-named-pkg-resources-after-upgrade-of-pyth

Всё ещё ищете ответ? Посмотрите другие вопросы с метками .