Почему Portage жалуется на отсутствие Python-модуля `portage`?

699
Blacklight Shining

В настоящее время я пытаюсь настроить префикс Gentoo. Я взял скрипт начальной загрузки и запустил его, он прошел половину этапа и завершил установку заголовков ядра до того, как Portage сломался. Похоже, что скрипт продолжал пытаться установить еще несколько пакетов, но любая попытка вызвать emergeпросто приводит к ImportError:

Traceback (most recent call last): File "$EPREFIX/usr/bin/emerge", line 41, in <module> import portage ImportError: No module named 'portage' 

Как ни странно, там есть, на самом деле, каталог в $EPREFIX/usr/lib/python2.7/site-packages/portageкомплекте с __init__.pyи по крайней мере пару десятков модулей. И вызов префикса python2напрямую с помощью -c 'import portage'отлично работает (это можно сделать с помощью Python хост-системы ImportError). Насколько я могу судить, все должно быть с использованием префикса Python; Префиксальный binы находятся на передней панели $PATH. Возможно, что-то во внутренностях скрипта ошибочно сбрасывается или игнорируется $PATH?

0

2 ответа на вопрос

0
Blacklight Shining

Double-check your python! It might not be the version you expect. On my system, python was symlinked to python3.5, even though sys-apps/portage (which provides the portage Python package) didn't yet have a target for Python 3.5. Argh!

At this point, you won't be able to rebuild portage with different targets (because emerge is broken), so check all of the installed Python versions (or dig around in $EPREFIX/usr/lib/python*/site-packages) until you find one with a portage package. If you have a working eselect (I did), you can use it (see eselect python help); else, you can probably get away with just manually changing the symlink. Portage worked fine for me after this.


As for the Prefix bootstrap…it seems that if you just run the script interactively again, it'll start allll over again, right from the beginning. I didn't want to start over, so I switched to the “manual” bootstrapping process and picked up at stage three, where the script had failed. I'm really not sure why this method is recommended against, given that the bootstrapping script does all the work, just like in the recommended method.

-1
spegry

I encountered the same probelem druing crosscompilation of an arm based system - armv7a-hardfloat-linux-gnueabi. The problem started after I uptedated portage eix and portage-utiles. next time chrooting and env-update or emerge the process faild with the exact message posted above.

I thought, it must be related to the executrion of the python script and emerged python-exec from the host environment - emerge went fine, however did not solve the problem. I staterd looking around in the lib directories and realzed that due to the crosse-dev environment I got a lib64 in /usr and in there a portage directroy. I merged them with /usr/lib and made asymlink from /usr/lib -> /usr/lib64. the same under /. the problem dscribed is gone for me.

I dont know if this will apply for your case too, but it might give you a new hint which direction to search ;)

cheers !

исправление, каталог /usr/lib/python2.7 и /usr/lib/python3.4 в / usr / lib / 64 ... spegry 8 лет назад 0
Не знаю, почему за это проголосовали, но у меня была похожая проблема при настройке мусульманина с поддержкой Crossdev. hanetzer 6 лет назад 0