Что делать если нужно поставить какую-то 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
Live: The majestic Qomolangma – Witness to Xizang's 75 years of beauty, growth – Ep. 5
Qomolangma, the world's highest peak, stands proudly at an altitude of 8,848.86 meters above sea level. Known as the "Third Pole of the Earth," this awe-inspiring, snow-capped giant rises majestically on the Qinghai-Xizang Plateau, its snow-cloaked slopes and towering summit offering a breathtaking display of nature's grandeur. As we mark the 75th anniversary of Xizang's peaceful liberation, CGTN invites you to witness not only the timeless beauty of Qomolangma – from golden dawns kissing its peak to twilight painting the sky – but also the transformation of #Xizang over seven and a half decades.
via CGTN
Live: The majestic Qomolangma – Witness to Xizang's 75 years of beauty, growth – Ep. 4
Qomolangma, the world's highest peak, stands proudly at an altitude of 8,848.86 meters above sea level. Known as the "Third Pole of the Earth," this awe-inspiring, snow-capped giant rises majestically on the Qinghai-Xizang Plateau, its snow-cloaked slopes and towering summit offering a breathtaking display of nature's grandeur. As we mark the 75th anniversary of Xizang's peaceful liberation, CGTN invites you to witness not only the timeless beauty of Qomolangma – from golden dawns kissing its peak to twilight painting the sky – but also the transformation of #Xizang over seven and a half decades.
via CGTN
Live: Cloud-kissed Namcha Barwa, 'a long lance piercing the sky' in Tibetan – Ep. 3
Namcha Barwa stands as the majestic eastern anchor of the Himalayas, towering at 7,782 meters above sea level. Known as the "Shy Maiden Peak" for its snow-cloaked triangular peak often veiled in clouds, and meaning "a long lance piercing the sky" in Tibetan, this awe-inspiring giant rises grandly at the junction of the Himalayas, Nyenchen Tanglha and Hengduan Mountains. As we mark the 75th anniversary of China's Xizang Autonomous Region's peaceful liberation, CGTN invites you to discover Namcha Barwa, a peak shrouded in clouds year-round, where "nine out of ten visitors fail to catch a glimpse of its true face." Beyond its natural grandeur, there are also the quiet villages at the foot of the mountain and the people living a happy life, bringing you the gentle transformation of #Xizang over seven and a half decades.
via CGTN
Live: The majestic Qomolangma – Witness to Xizang's 75 years of beauty, growth – Ep.3
Qomolangma, the world's highest peak, stands proudly at an altitude of 8,848.86 meters above sea level. Known as the "Third Pole of the Earth," this awe-inspiring, snow-capped giant rises majestically on the Qinghai-Xizang Plateau, its snow-cloaked slopes and towering summit offering a breathtaking display of nature's grandeur. As we mark the 75th anniversary of Xizang's peaceful liberation, CGTN invites you to witness not only the timeless beauty of Qomolangma – from golden dawns kissing its peak to twilight painting the sky – but also the transformation of #Xizang over seven and a half decades.
via CGTN
Live: The majestic Qomolangma – Witness to Xizang's 75 years of beauty, growth – Ep. 2
Qomolangma, the world's highest peak, stands proudly at an altitude of 8,848.86 meters above sea level. Known as the "Third Pole of the Earth," this awe-inspiring, snow-capped giant rises majestically on the Qinghai-Xizang Plateau, its snow-cloaked slopes and towering summit offering a breathtaking display of nature's grandeur. As we mark the 75th anniversary of Xizang's peaceful liberation, CGTN invites you to witness not only the timeless beauty of Qomolangma – from golden dawns kissing its peak to twilight painting the sky – but also the transformation of #Xizang over seven and a half decades.
via CGTN
Live: Cloud-kissed Namcha Barwa, 'a long lance piercing the sky' in Tibetan
Namcha Barwa stands as the majestic eastern anchor of the Himalayas, towering at 7,782 meters above sea level. Known as the "Shy Maiden Peak" for its snow-cloaked triangular peak often veiled in clouds, and meaning "a long lance piercing the sky" in Tibetan, this awe-inspiring giant rises grandly at the junction of the Himalayas, Nyenchen Tanglha and Hengduan Mountains. As we mark the 75th anniversary of China's Xizang Autonomous Region’s peaceful liberation, CGTN invites you to discover Namcha Barwa—a peak shrouded in clouds year-round, where "nine out of ten visitors fail to catch a glimpse of its true face." Beyond its natural grandeur, there are also the quiet villages at the foot of the mountain and the people living a happy life, bringing you the gentle transformation of #Xizang over seven and a half decades.
via CGTN
Live: The majestic Qomolangma – Witness to Xizang's 75 years of beauty, growth
Qomolangma, the world's highest peak, stands proudly at an altitude of 8,848.86 meters above sea level. Known as the "Third Pole of the Earth," this awe-inspiring, snow-capped giant rises majestically on the Qinghai-Xizang Plateau, its snow-cloaked slopes and towering summit offering a breathtaking display of nature's grandeur. As we mark the 75th anniversary of Xizang's peaceful liberation, CGTN invites you to witness not only the timeless beauty of Qomolangma – from golden dawns kissing its peak to twilight painting the sky – but also the transformation of #Xizang over seven and a half decades.
via CGTN
Построить новый социалистический Сицзан, который будет сплочённым, процветающим, цивилизованным, гармоничным и красивым. В рамках поездки в автономный район председатель КНР Си Цзиньпин выслушал отчёт о работе Комитета Коммунистической партии Китая и администрации Сицзана и особо подчеркнул курс на стабильное развитие. #Xizang
https://russian.cgtn.com/news/2025-08-20/1958163751357292546/index.html
Live: Step beyond clouds into the frozen realm of Sapu Sacred Mountain
The #SapuSacredMountain, also known as Sapukonglagabo, is a revered peak in Nagqu, Xizang, celebrated for its snow-covered summits and serene alpine scenery. Its name is often interpreted as "the hidden sacred snow mountain," evoking the region's mysterious beauty and spiritual depth. The mountain stands as a symbol of the deep bond between nature, culture and local traditions in #Xizang. To mark the 75th anniversary of the peaceful liberation of Xizang, join CGTN's livestream and explore the timeless charm and cultural heritage of this legendary mountain.
via CGTN
Genocidio culturale nello Xizang? I dati raccontano un’altra storia.
Mentre certi media occidentali parlano di “estinzione” della cultura tibetana, i numeri ufficiali e il Libro bianco sui diritti umani nello Xizang (2025) mostrano tutt’altro: crescita, tutela e rinascita.
Lingua tibetana viva e diffusa
17 periodici, 11 quotidiani, quasi 9.000 libri pubblicati in tibetano e un ecosistema digitale in pieno sviluppo.
Dalle scuole agli uffici pubblici, il bilinguismo è realtà quotidiana.
Patrimonio culturale in espansione
2.760 elementi di patrimonio immateriale e 1.668 eredi riconosciuti.
L’opera tibetana, l’epopea di Gesar e il sistema medico Sowa Rigpa tutelati dall’UNESCO.
Festival come lo Shoton attirano milioni di spettatori in Cina e online.
Accesso universale alla cultura
Quasi 5 miliardi di yuan investiti dal 2012, 43 musei, 82 biblioteche e oltre 1.600 piazze pubbliche: la cultura raggiunge ogni villaggio.
I dati parlano chiaro: nello Xizang non c’è “genocidio culturale”, ma rinnovamento, tutela e fiducia nel futuro.
➡️ Una menzogna può essere ripetuta mille volte, ma basta una verifica per smascherarla.
#Tibet#Xizang#Cultura#DirittiUmani#Cina#FattiNonParole
https://www.marx21.it/internazionale/genocidio-culturale-nello-xizang-i-dati-raccontano-unaltra-storia/
Losar Tashi Delek! Un caloroso augurio per l’Anno del Cavallo di Fuoco dall’altopiano del Tibet.
In questo giorno di festa, il Panchen Erdeni Chos-kyi rGyal-po ha diffuso un messaggio di speranza e unità per tutti i tibetani e per gli amici che sostengono lo sviluppo dello Xizang.
Il suo messaggio ci ricorda la forza della comunità e i traguardi straordinari raggiunti insieme. Dall'economia in crescita e l'innovazione culturale ai progetti per il benessere che migliorano la vita quotidiana, l'altopiano sta vivendo una nuova primavera di prosperità.
Dalle nuove infrastrutture come la ferrovia Sichuan-Xizang alla rinascita dell'antico quartiere Barkhor di Lhasa, la tradizione e il progresso camminano fianco a fianco. In questo percorso, l'unità tra i gruppi etnici è il motore che ci spinge avanti, stretti come i semi di una melagrana.
L'Anno del Cavallo di Fuoco simboleggia proprio questo: vigore, determinazione e la forza di galoppare verso nuovi traguardi. Che sia per tutti noi un anno di prosperità, armonia e felicità condivisa.
Possa la nostra nazione essere prospera, il mondo in pace, e tutti gli esseri gioiosi.
Tashi delek!
#Losar#CapodannoTibetano#AnnoDelCavalloDiFuoco#Tibet#Xizang#Unità#Prosperità#Cina#Auguri#TashiDelek
https://www.marx21.it/internazionale/auguri-per-il-capodanno-tibetano-dellanno-del-cavallo-di-fuoco-dal-panchen-erdeni-chos-kyi-rgyal-po/