Instalasi python secara besar-besaran mengacaukan menghentikan Yum dari menjalankan di Redhat

1

Dengan bodoh saya rm'd / usr/lib/python2.6 ketika mencoba menginstal 2.7.3 dan sekarang sistem saya sangat kacau.

Saya tidak bisa menjalankan yum, pip atau easy_install.

Yum tidak berfungsi:

[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 tidak berfungsi

[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 tidak bekerja

[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

Saya mencoba menginstal ulang setuptools secara manual lagi (mudah-mudahan ini dapat menginstal 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 dan 2.6.6 berfungsi dengan baik.

Ada ide tentang bagaimana memperbaiki situasi ini?

--------- Perbarui ------------ rpm -V yummenghasilkan banyak file yang hilang, bagaimana saya bisa menginstal ulang ini?

[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

--------SUNTING--------------

'dipecahkan' dengan menghapus semuanya dan melakukan instalasi baru. Pelajaran yang dipetik! Jangan rm -rf hal yang tidak kamu mengerti: P

LittleBobbyTables
sumber

Jawaban:

1

Menyeka semuanya dan melakukan instalasi baru. Terlalu lama untuk menginstal ulang yum, easy_install, pip untuk kedua python2.6 dan 2.7

LittleBobbyTables
sumber
1
Terkadang hapus dan instal ulang adalah yang tercepat.
smci
0

pkg_resources disediakan oleh Distribute atau setuptools Seperti yang diumumkan di PyCon 2013, proyek Distribute dan setuptools telah bergabung kembali. Distribusikan sekarang sudah tidak digunakan lagi dan Anda hanya perlu menggunakan alat setup saat ini yang baru. Coba ini:

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

Penjelasan asli di sini: https://stackoverflow.com/questions/1756721/what-is-causing-importerror-no-module-named-pkg-resources-after-upgrade-of-pyth

doizuc
sumber