Что делать если нужно поставить какую-то 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
News: #PM_Abiy defends economic policies, cites export gains, debt restructuring, and ‘unprecedented’ agricultural growth
Prime Minister Abiy Ahmed defended the government’s economic and development policies on Tuesday, citing strong export earnings, progress in debt restructuring, industrial growth, and what he described as unprecedented gains in agricultural productivity.
The Prime Minister’s remarks were delivered in response to questions from MPs over economic conditions, inflation, and living costs, with the government positioning recent performance figures as evidence that its reform agenda remains on track.
At the session where the Prime Minister appeared to present the government’s six-month performance report during the 10th regular session of the 5th year of the House of Peoples’ Representatives (#HoPR), lawmakers questioned the government’s macroeconomic direction and sectoral performance.
However, PM Abiy defended his government’s records.....
Read more: https://addisstandard.com/?p=54938
#Ethiopia: Law enforcement agencies assessing local security, preparing nationwide security map ahead of election – #PM_Abiy says
Prime Minister Abiy Ahmed (PhD) said law enforcement agencies are assessing local security conditions across the country and preparing a comprehensive nationwide security map as part of preparations for the upcoming national election.
The Prime Minister made the remarks during the 10th regular session of the 5th year of the 6th House of Peoples’ Representatives (#HoPR), while responding to lawmakers’ concerns over election-related security.
Abiy said more than 88,000 data collectors have been deployed in 19,650 kebeles nationwide to gather information, which is being used by security institutions to evaluate conditions on the ground and identify potential risks. The assessments, he noted, are intended to ensure that polling takes place in a safe and orderly manner.
Maintaining that Ethiopia’s overall security situation …
Read more: https://addisstandard.com/?p=54969
News: #PM_Abiy tells lawmakers #Ethiopia to get first AI university next year; announcement marks world’s second after #UAE
Prime Minister Abiy Ahmed (PhD) announced that Ethiopia is working to establish what he described as the world’s second university dedicated exclusively to Artificial Intelligence (#AI), as part of the government’s push to position technology as a pillar of long-term national development.
The Prime Minister made the remarks while addressing lawmakers during the 10th regular session of the 5th year of the House of Peoples’ Representatives (#HoPR), in the course of presenting and defending the government’s performance and policy direction.
“It is essential to prepare our youth today for the competitions of tomorrow,” Abiy told parliament, adding that technology has been identified as “one of Ethiopia’s five pillars of growth” to ensure that current policies serve future generations.
Although PM Abiy did not mention, the UAE....
Read more: https://addisstandard.com/?p=54944
News: #PM_Abiy traces rift with #Eritrea to atrocities in #Tigray, not Red Sea access
Prime Minister Abiy Ahmed (PhD) told the House of Peoples’ Representatives (#HoPR) that the deterioration in relations between #Ethiopia and Eritrea began during the early phases of the two-year devastating war in the Tigray region, citing atrocities committed by Eritrean forces, and not Ethiopia’s push for access to the #Red_Sea.
Addressing lawmakers today, the Prime Minister rejected analyses that link the current rift to Ethiopia’s maritime ambitions. “Some people argue, think, and analyze that the problem between the Ethiopian and Eritrean governments arose because the Ethiopian government raised the Red Sea question. This is not the case,” Abiy said. He added that tensions long predated the sea access debate and “began during the start of the Tigray war.”
It is recalled that in October 2025, PM Abiy linked the deterioration in relations with Asmara to developments....
Read more: https://addisstandard.com/?p=54951
News: The process of returning displaced persons to #Western_Tigray remains difficult – #PM_Abiy
Prime Minister Abiy Ahmed (PhD) told parliament that efforts to facilitate the return of internally displaced persons (#IDPs) to Western Tigray continue to face serious challenges, citing political contestation and competing territorial claims over the area.
The Prime Minister made the remarks during the 10th regular session of the 6th House of Peoples’ Representatives (#HoPR), while responding to lawmakers’ questions on the situation of displaced communities across the country.
Abiy said the federal government’s primary difficulty lies in Western Tigray, where, according to him, certain actors have obstructed return processes by “sowing seeds of exile and displacement” and using displaced populations as political leverage.
He stressed that any Ethiopian, including original residents of Western Tigray, has a “100 percent right to live peacefully in the area.”....
Read more: https://addisstandard.com/?p=54960
News: #Ethiopia ratifies prisoner transfer and extradition agreements with #China, #Brazil, and #South_Africa
The Ethiopian House of Peoples’ Representatives (#HoPR) has ratified proclamations approving prisoner transfer agreements with the People’s Republic of China and the Federal Republic of Brazil, as well as a criminal extradition agreement with the Republic of South Africa.
In a statement issued following the House’s ninth session on 22 January 2026, the HoPR said Etsegenet Mengistu, Chairperson of the Legal, Justice and Democracy Affairs Standing Committee, told lawmakers that the agreements aim to support the rehabilitation of Ethiopian citizens convicted abroad by allowing them to serve their sentences in Ethiopia.
According to the statement, Etsegenet explained that serving sentences closer to familiar communities, languages, and cultural environments contributes to more effective rehabilitation and social reintegration.
The HoPR said the...
Read more: https://addisstandard.com/?p=54702
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
#Ethiopia: MP Abebaw challenges peace talks with splinter armed groups
Member of Parliament Dr. Abebaw Desalew of the National Movement of Amhara (#NaMA) has questioned Prime Minister #Abiy Ahmed over the federal government’s approach to peace negotiations and regional security, warning that talks with what he described as “splinter groups” have failed to bring tangible improvements on the ground.
Dr. Abebaw raised the concerns during the 10th Regular Session of the 5th Year of the 6th Term of the House of Peoples’ Representatives (#HoPR), where MPs questioned the Prime Minister on the government’s six-month performance report.
He said Ethiopia continues to face a pervasive lack of peace, particularly in conflict-affected regions including #Amhara, #Oromia, #Tigray, and #Gambella, while noting that serious human rights violations are also reported in regions without active armed conflict.
“Even in areas not experiencing open conflict, members from the...
Read more: https://addisstandard.com/?p=54927