Что делать если нужно поставить какую-то 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
🎙President Vladimir Putin congratulated Russian women on International Women’s Day (March 8, 2026)
On March 7, Russia's President held a meeting at the Kremlin with women serving the Motherland on the front lines and beyond – military personnel, doctors, war correspondents, artists & professionals from across the country.
💬 Vladimir Putin: We always celebrate this holiday with the warmest and most heartfelt feelings.
We admire our wonderful women and express our love, appreciation and gratitude from the bottom of our hearts.
Women make the world better and kinder with their generosity, compassion and genuine female wisdom. A mother’s love remains in every person’s heart for a lifetime – it warms us, multiplies our joyful emotions and gives us strength in the most difficult moments.
There are no heights beyond the reach of our women. You achieve remarkable success in many different professions. And when circumstances demand it – you demonstrate exceptional resilience, determination and strong leadership.
You never hesitate to help those who need your assistance, surrounding your families and loved ones with care and attention and dedicating yourselves to educating children.
Of course, managing to strike us with your beauty and charm while doing hard work, showing commitment and stamina is a formidable task, but you have succeeded in it.
It is essential that we recognise and understand this. As for us, we reaffirm our commitment to create all the necessary conditions, both at the state level and, no doubt, in our families to enable women to strike a balance between motherhood and professional excellence, empowering them to fulfil their potential so that they do not have to wait too long before they can experience the joy of having a family, becoming a spouse and a mother.
On a special note, I would like to congratulate women who are performing their duties in the special military operation zone and are facing extreme hardship while working in Donbass and Novorossiya and in our border regions. Wherever you find yourselves, you have been demonstrating valour and courage, selflessness and strength of spirit. You have my sincere and heartfelt gratitude for that.
Dear women,
The sky is the limit for you. You are sources of creation and development, and you combine resilience with tenderness. Your commitment to create a better future for your children inspires all of us to keep moving forward.
I wish you happiness with those dear to you, success in everything that matters to you, and sound health and well-being to you and your loved ones.
💐Happy holiday! Happy International Women’s Day!
#InternationalWomensDay#March8
🎙President Vladimir Putin congratulated Russian women on International Women’s Day (March 8, 2026)
On March 7, Russia's President held a meeting at the Kremlin with women serving the Motherland on the front lines and beyond – military personnel, doctors, war correspondents, artists & professionals from across the country.
💬 Vladimir Putin: We always celebrate this holiday with the warmest and most heartfelt feelings.
We admire our wonderful women and express our love, appreciation and gratitude from the bottom of our hearts.
Women make the world better and kinder with their generosity, compassion and genuine female wisdom. A mother’s love remains in every person’s heart for a lifetime – it warms us, multiplies our joyful emotions and gives us strength in the most difficult moments.
There are no heights beyond the reach of our women. You achieve remarkable success in many different professions. And when circumstances demand it – you demonstrate exceptional resilience, determination and strong leadership.
You never hesitate to help those who need your assistance, surrounding your families and loved ones with care and attention and dedicating yourselves to educating children.
Of course, managing to strike us with your beauty and charm while doing hard work, showing commitment and stamina is a formidable task, but you have succeeded in it.
It is essential that we recognise and understand this. As for us, we reaffirm our commitment to create all the necessary conditions, both at the state level and, no doubt, in our families to enable women to strike a balance between motherhood and professional excellence, empowering them to fulfil their potential so that they do not have to wait too long before they can experience the joy of having a family, becoming a spouse and a mother.
On a special note, I would like to congratulate women who are performing their duties in the special military operation zone and are facing extreme hardship while working in Donbass and Novorossiya and in our border regions. Wherever you find yourselves, you have been demonstrating valour and courage, selflessness and strength of spirit. You have my sincere and heartfelt gratitude for that.
Dear women,
The sky is the limit for you. You are sources of creation and development, and you combine resilience with tenderness. Your commitment to create a better future for your children inspires all of us to keep moving forward.
I wish you happiness with those dear to you, success in everything that matters to you, and sound health and well-being to you and your loved ones.
💐Happy holiday! Happy International Women’s Day!
#InternationalWomensDay#March8
💎Aziz va qadrli ayollar!
💐8 mart – Xalqaro xotin-qizlar kunibilan sizlarni samimiy muborakbod etamiz!
🌸Siz – hayotimizning fayzi, oilalarimizning tayanchi, jamiyatimizning ilhom manbaisiz.
🎀Sizga mustahkam sog‘lik, cheksiz baxt, qalbingizga xotirjamlik va ezgu orzularingiz ro‘yobini tilaymiz. Har bir kuningiz mehr-muhabbat, e’tibor va e’tirofga to‘la bo‘lsin. Yuzingizdan tabassum, qalbingizdan quvonch arimasin!
Samimiy hurmat bilan,
Biznes va tadbirkorlik oliy maktabi
__________
💎Дорогие и уважаемые женщины!
💐 Поздравляем вас с Международным женским днём – 8 Марта!
🌸Вы – украшение нашей жизни, опора наших семей и источник вдохновения для всего общества.
🎀Желаем вам крепкого здоровья, безграничного счастья, душевного спокойствия и исполнения самых светлых мечтаний. Пусть каждый ваш день будет наполнен любовью, вниманием и признанием. Пусть улыбка не сходит с вашего лица, а радость всегда живёт в вашем сердце!
С искренним уважением,
Высшая школа бизнеса и предпринимательства
#GSBE#GraduateSchool#March8#HappyWomensDay
🔝Web-site |🔝Facebook | 🔝Instagram | 🔝Youtube
International Women’s Day at the Russian House Brussels
On the occasion of International Women’s Day, the Russian House Brussels is pleased to invite you to a series of cultural events dedicated to women — their dignity, strength and enduring inspiration.
🌸Concert “She Connects Worlds”
📅 5 March | 19:00–21:00 | Free admission
Registration:
https://rushouse.be/event/concert-she-connects-worlds/
🌷Concert dedicated to March 8 “Mother, Wife and Sister”
📅 12 March | 19:00–20:30
Registration:
https://rushouse.be/event/concert-dedicated-to-march-8-mother-wife-and-sister/
The programme will feature music and poetry, highlighting the richness of cultural traditions and paying tribute to the role of women in family, society and the arts.
We look forward to welcoming you to the Russian House Brussels for these special evenings.
📍 Russian House Brussels
Registration is required.
#InternationalWomensDay#March8#RussianHouseBrussels#Culture
This morning started with flowers from my friends — they left a bouquet by my door while I was still sleeping. A little miracle that set the mood for the whole day.
#LunaEverly#March8#WomensDay#Flowers#Holiday#Spring
🌸 Мимоза – аромат весны и нежности! 🌸
Какой цветок первым приходит на ум, когда говорят о 8 Марта? Конечно, мимоза! ☀️ Её золотистые пушистые цветы источают сладковато-медовый аромат с лёгкими зелёными нотами – как предчувствие тепла, солнца и обновления.
✨ Аромат месяца – «Мимоза» от BAGO home! ✨
Весь март -20% на всю коллекцию:
💛 Аромадиффузоры (50 и 100 мл)
💛 Наполнители (рефиллы) 200 мл
💛 Аромаспреи 100 мл
💛 Аромасаше
💛 Свечи из соевого воска (40 часов горения)
Наполните дом атмосферой цветущего сада! 🌿💛
Заказывайте на нашем сайте 🌸
#BAGOhome#Мимоза#АроматВесны#ПодарокК8Марта#ВесеннееНастроение#СимволВесны#АроматМесяца#АроматДляДома#Аромасвечи#Аромадиффузор#SoyCandles#HomeFragrance#SpringScent#GiftForHer#March8#SpringMood#Discount