Что делать если нужно поставить какую-то 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
#documentary#fascism
You voted - we did it! Here’s the first full documentary we uploaded on Telegram. Fascism: A History explores the nature of the ideology and how it’s been tainting societies long after Hitler. It’s also relevant to the current events unfolding in Ukraine.
The documentary reveals how NATO, created after WWII, carried on with colonial politics and expanded to the east under the auspices of bringing democracy.
Share your thoughts in the comments, and don’t forget to subscribe to our channel on Odysee.
All of our films are available on https://odysee.com/@RTDocumentary:4 and RTD.RT.com
Follow: https://t.me/rtdocumentary
Fascism at Work: Propaganda, Conspiracy, Lies, Hatred, and Incompetence in Ethiopia. Read more.
https://borkena.com/2026/03/23/ethiopia-fascism-at-work-propaganda-conspiracy-lies-hatred-and-incompetence-in-ethiopia/#Ethiopia#politics#EthiopianPolitics#Fascism
In the latest VA interview, Javier Couso, a keynote speaker at the recent World Congress Against Fascism in Caracas discussed the fascist attacks on Venezuela.
He highlighted Venezuela’s resistance to fascist tactics by liberal democracies, marking it as a key player in the global struggle for sovereignty and democracy. 'Venezuela is a beacon in the fight for sovereignty and true democracy,' stated Couso.
Read the full interview here 👉🏼https://shorturl.at/Ej6UL
#VAInterview#Fascism#PresidentialElections2024
Following President Nicolás Maduro’s inauguration for a third term on January 10, violent groups vandalized Venezuelan diplomatic offices in Lisbon (Portugal), Frankfurt (Germany), Medellín (Colombia), Vigo (Spain), and San José (Costa Rica). Venezuela’s Foreign Affairs Minister, Yván Gil, described these actions as “coordinated.”
“In a coordinated action by the extremists of deranged fascism, multiple consulates have been targeted by those who aim to damage our diplomatic missions like they do our beloved Bolivarian Homeland,” Gil stated on social media.
Read the full report: https://shorturl.at/tC2dt
#Venezuela#diplomaticmissions#fascism
Venezuela's National Assembly takes a dual stance against fascism and territorial disputes, passing anti-fascism legislation while reaffirming its claim over Essequibo amid alleged CIA and US Southern Command threats.
Read more 👉🏽https://shorturl.at/aeOP7
#fascism#laws#Essequibo#Venezuela
In the latest VA interview, Hindu Anderi discusses Venezuela’s Antifascist Law, which is nearing approval. She explains how the Platform for Solidarity with the Palestinian Cause is actively lobbying to include Zionism in the legislation. "Zionism is fascism’s twin... a racist movement based on supremacy and expansion," Anderi states.
Read the full interview here 👉🏼https://shorturl.at/xBM4T
#Fascism#InternationalSolidarity#Laws#Zionism
I play Stardew often as a cozy way to wind down and disconnect from the horrors. Today I see that the Trump Administration is using it for Slopaganda.
It's not even about anything consequential — apparently for the last 15 years whole milk was removed from school cafeterias, and it's been restored via executive order.
#USA#Politics#Slop#ImageGen#Fascism
The Stern Gang: Ideology, Politics and Terror, 1940–1949
by Joseph Heller
This study of Lehi (aka the Stern Gang) attempts to demythologize the image of this extremist, Zionist underground group. The book analyzes the party's split from the Irgun Zvai Leumi (National Military Organization) and its attempts to synthesize the politics and ideals of the right and left. Lehi's leader Stern stated that he incorporated elements of both the left and the right.
#Zionism#NationalBolshevism#Fascism#Nazism#Palestine
On Fascism and Other Maladies: A Conversation with Luis Britto García
One of Venezuela’s most respected intellectuals talks about fascism and corruption scandals in the lead-up to the presidential elections.
Read the full interview here 👉🏼shorturl.at/cexUZ
#VAInterview#LuisBrittoGarcia#Venezuela#presidentialelections2024#interview#corruption#fascism
Fascism Putin-style is not abstract rhetoric but a set of concrete signs: cult of personality, militarism, repression, imperial aggression. The article provides a clear analysis without euphemisms.
https://yep.uz/en/2025/09/putin-fascism-signs/
#fascism#putin#dictatorship#Uzbekistan repression #militarism#censorship#ukraine#zsymbols#russianworld