Что делать если нужно поставить какую-то Python-библиотеку а root-прав нет? То есть в систему библиотеку никак и ничего не поставить.
Есть как минимум два способа это решить правильно!
🔸 Сделать виртуальное окружение и ставить там что угодно.
Это позволит создать полностью независимое исполняемое окружение для ваших приложений.
Все библиотеки будут храниться в домашней директории юзера а значит доступ на запись имеется.
Создать очень просто:
python3 -m venv ~/venvs/myenvname
Теперь активируем окружение
# Linux
source ~/venvs/myenvname/bin/activate
# Windows
%userprofile%\venvs\myenvname\Scripts\activate.bat
Можно ставить любые библиотеки и запускать приложение.
Это стандартный метод работы с любым проектом. Если еще не используете его, то пора начинать. Даже при наличии root доступа!
🔸 Бывает, что нет возможности запустить приложение из своего виртуального окружения. Например, его запускает какой-то сервис от вашего юзера и вставить активацию окружения вы не можете.
В этом случае можно установить библиотеки для Python не глобально в систему, а только для юзера.
Выполните этот код в консоли:
python3 -m site
Вы получите что-то такое:
sys.path = [
'/home/user',
'/usr/lib/python37.zip',
'/usr/lib/python3.7',
'/usr/lib/python3.7/lib-dynload',
'/home/user/.local/lib/python3.7/site-packages',
...
]
USER_BASE: '/home/user/.local'
USER_SITE: '/home/user/.local/lib/python3.7/site-packages'
ENABLE_USER_SITE: True
Нас интересует параметр USER_SITE. Это путь к пользовательским библиотекам, которые доступны по умолчанию, если они есть.
Именно сюда будут устанавливаться модули если добавить флаг --user при установке чего-либо через pip
pip install --user requests
Для этой команды не нужны root-права.
После неё можно запускать системный интерпретатор без виртуальных окружений и установленная библиотека будет доступна для текущего юзера.
Параметр USER_BASE показывает корневую директорию для хранения user-библиотек. Её можно изменить с помощью переменной окружения PYTHONUSERBASE
export PYTHONUSERBASE=~/pylibs
python3 -m site
...
USER_BASE: '/home/user/pylibs'
USER_SITE: '/home/user/pylibs/lib/python3.7/site-packages'
Получается некоторое подобие виртуального окружения для бедных 😁 которое можно менять через эту переменную (не делайте так!Лучше venv!)
🔸 Дописывание пути в PYTHONPATH
Этот способ не входит в список "двух правильных", но тоже рабочий. Здесь придётся сделать всё несколько сложней.
Сначала ставим библиотеку в любое место указывая путь установки
pip3 install -t ~/mylibs modulename
Библиотека установится без привязки к какому-либо интерпретатору. То есть по умолчанию не будет видна. Теперь в нужный момент добавляем этот путь в sys.path или в PYTHONPATH.
Не буду советовать так делать. Единственный раз когда этот способ мне пригодился и решил поставленную задачу, это при создании общей библиотеки для кластера компьютеров.
Модули лежат в сети и подгружаются для всех из одного и того же места. То есть обновлять файлы требуется только один раз а не на всех хосты отдельно.
Минусы такого подхода:
▫️Нужно всем хостам пробить нужный путь в .bashrc или ещё куда-то чтобы он сетапился на старте.
▫️Чем больше хостов тем больше нагрузка на сеть. Иногда такой способ не подходит именно по этой причине. Тогда Ansible вам в помощь.
▫️Не очень подходит если хосты с разными операционками. Некоторые библиотеки различаются для Linux и Windows (там, где есть бинарники) и приходится мудрить более сложные схемы.
#tricks#basic
From Strategic Silence to Sovereign Statecraft: Recalibrating Ethiopia’s Path on the GERD. Read.
https://borkena.com/2026/01/26/ethiopia-gerd-from-strategic-silence-to-sovereign-statecraft-recalibrating-ethiopias-path-on-the-gerd/#Ethiopia#GERD#Egypt
News: #Egypt shifts narrative on GERD, demands compensation from #Ethiopia
Egypt has shifted its public stance on the Grand Ethiopian Renaissance Dam (#GERD), with the country’s Minister of Water Resources and Irrigation, Hani Sweilem, demanding that the dam pay compensation for the damage it has caused to Egypt and #Sudan.
Speaking during a plenary session of the Egyptian Senate on Sunday, Minister Sweilem said that no dam of GERD’s scale has ever been constructed on the Nile River through unilateral action. He claimed the dam has already reduced Egypt’s share of Nile water by 38 billion cubic meters from its allocated 55 billion cubic meters.
Ethiopia, which built the GERD on the Blue Nile in line with its sovereign rights, has consistently emphasized that the dam is designed to regulate seasonal floods and generate hydropower, not to reduce downstream water allocations.
On 16 January 2026, #US President Donald J. Trump offered to restart .....
Read more: https://addisstandard.com/?p=54644
The Spirit of Adwa Must Carry Ethiopia Through GERD and the RED SEA. Read more.
https://borkena.com/2026/03/25/ethiopia-the-spirit-of-adwa-must-carry-ethiopia-through-gerd-and-the-red-sea/#Ethiopia#politics#geopolitics#GERD#EthiopianPolitics
Why International Law Supports Ethiopia’s Right to Build the GERD. Read more.
https://borkena.com/2026/01/28/ethiopia-why-international-law-supports-ethiopias-right-to-build-the-gerd/#Ethiopia#Egypt#GERD#InternationalLaw
#Commentary: From Internal Unity to Strategic Diplomacy: #Ethiopia’s playbook for dealing with Trump’s #America
In this commentary, Teferi Tafa examines how the Trump administration’s renewed engagement over the Grand Ethiopian Renaissance Dam (#GERD) and Nile water disputes has intensified Ethiopia’s strategic challenges. He notes that “Ethiopia faces a critical moment that demands not just reactive diplomacy but a comprehensive strategy rooted in internal cohesion and enhanced bargaining power.”
Highlighting internal division and conflicts as the greatest vulnerability, Teferi states, “No amount of diplomatic maneuvering can compensate for a house divided against itself.”
He concludes, “Ethiopia’s response to this diplomatic moment will define not just its relationship with the Trump administration but also its trajectory for the coming decade.”
https://addisstandard.com/?p=54948
Donald Trump Thinks the flow of Nile water is “blocked” by the Ethiopian Dam. Read more. https://borkena.com/2026/01/22/trump-remark-on-ethiopian-dam-all-of-a-sudden-the-water-flow-is-blocked/#Ethiopia#News#Trump#Nile#GERD#Egypt
News: #Egypt denies report linking Red Sea access to #GERD flexibility
Egypt has categorically denied claims that it offered to help #Ethiopia secure access to the #Red_Sea in exchange for flexibility over the Grand Ethiopian Renaissance Dam (GERD), according to Al-Ahram.
Citing a responsible Egyptian source, the newspaper said on Tuesday that reports suggesting Cairo was prepared to grant Ethiopia maritime access were “entirely unfounded” and had no basis in fact. The source reaffirmed that Egypt’s position on water security and the GERD “remains firm and unchanged.”
The denial follows a report by The National, which cited unnamed sources in Cairo as saying Egypt had conveyed a proposal to Prime Minister #Abiy Ahmed last week.
“No other states have the right to participate in any arrangements or understandings concerning the Red Sea,” the source added.
Read more: https://addisstandard.com/?p=55395
#Commentary: When Mediation Becomes Intimidation: #GERD, Trump, and #Ethiopia’s sovereign rights
The Grand Ethiopian Renaissance Dam (GERD) is now fully operational, shifting the Nile dispute from theory to practical governance and transforming Ethiopia’s energy sector. However, Hassen Mama Muse argues that this progress is threatened by “biased external interference,” particularly from #US President Donald Trump.
He describes Trump’s renewed mediation offer as not a diplomatic opening but “a form of coercive diplomacy.”
Hassen points to Trump’s rhetoric—labeling the dam as “stopping the #Nile” and suggesting #Egypt should “blow up the dam”—as clear evidence that he cannot act as “a neutral mediator.” Engaging in such a process, the author cautions, would force Ethiopia to “compromise” its lawful rights.
https://addisstandard.com/?p=54740
Days after letter to #Egypt’s President El-Sisi, #Trump vows to resolve 'GERD dispute'
Speaking at a #White_House press briefing yesterday, U.S. President Donald Trump said he had intervened to avert a potential conflict between #Ethiopia and Egypt over the Grand Ethiopian Renaissance Dam (#GERD), claiming the two countries “were going to fight over a dam.”
Trump described GERD as “the biggest dam in the world,” alleged it restricts Nile water flow to Egypt, and reiterated his claim that the United States financed the project.
In July, the GERD Coordination Project Office rejected the claim, with Deputy CEO Fikrte Tamiru saying the dam was built through public and government support, without “a single cent” from foreign loans or aid, and calling it the product of Ethiopians’ “sweat, labor, and even blood.”
Trump said the issue remains unresolved.
Watch
News: #PM_Abiy rejects claims of foreign financing for #GERD, says project built without external loans or aid
Prime Minister Abiy Ahmed has publicly pushed back against claims that the Grand #Ethiopian Renaissance Dam (GERD) was financed by the #United_States or other foreign actors, stating that the flagship project was completed without Ethiopia taking “a single birr” in external loans or foreign aid.
The Prime Minister made the remarks while responding to questions during a regular session of the House of Peoples’ Representatives (#HoPR) on Tuesday, marking the first time he has directly addressed, in a parliamentary setting, recent rhetoric alleging foreign financing of the dam.
GERD is a historic national project realized entirely through the sacrifice, determination, and contributions of the Ethiopian people, Abiy told lawmakers, emphasizing that both citizens at home and members of the diaspora financed the project ....
Read more: https://addisstandard.com/?p=54933