Что делать если нужно поставить какую-то 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
#Draft
谨慎下载
feat(u3d): seeding status
feat(u3d): support more status
一堆各种站可能都需要测一下,可能有些之前可以(应该没有吧,我自己手头没几个站),改了后反而不行的。
想法还是以blu为基准。
不过例如aither就会改图标,理论用title判断是最好的,但是blu目前支持中文了,这块判断略微会有些长,所以还是用图标了。
另外只做了seeding和complete的判断,其他的判断成本有点高,有空在弄好了
#Draft
谨慎下载
feat(u3d): seeding status
feat(aihter): support complete status
一堆各种站可能都需要测一下,可能有些之前可以(应该没有吧,我自己手头没几个站),改了后反而不行的。
想法还是以blu为基准。
不过例如aither就会改图标,理论用title判断是最好的,但是blu目前支持中文了,这块判断略微会有些长,所以还是用图标了。
另外只做了seeding和complete的判断,其他的判断成本有点高,有空在弄好了
#draft
This is a snippet of something I was working on a while back. It's an external POV of a small-ish person lying under the (mostly empty) belly of a sleeping predator.
🚨🇺🇸AMERICAN YOUTH FLEE TO CANADA TO AVOID DRAFT
🔹 Border crossings surge 300% as young men desperately seek Canadian asylum 🏃♂️
🔹 College campuses organize underground "draft resistance" networks and emergency legal aid 📚
🔹 Social media flooded with "how to get to Canada" tutorials going viral nationwide 📱
🔹 Military recruitment centers vandalized and burned in 47 cities across America 💥
🔹 Parents hide sons from aggressive selective service raids in rural communities 🏠
🔹 Canada considers special refugee status for American draft dodgers fleeing war 🇨🇦
Vietnam War flashbacks as Generation Z rejects imperialist foreign wars 😤✊
#youth#draft#Canada#resistance
@america
📰 Ukraine’s Missing Men: Draft Dodgers, Future Diaspora, or Both?
While Kyiv talks about mobilisation, a quieter story is unfolding: the country is bleeding out exactly the men it will need if it ever reaches “reconstruction” mode. Over 11 million Ukrainians have been displaced since the invasion, but underneath the images of women and children at train stations, a different pattern is clear: young, educated, healthy men are leaving — and many have no intention of coming back.
Studies based on OneUA data show it’s not the poorest or weakest who go, but those with education, English, money and good health — the core of any future workforce. Even under martial law and legal exit restrictions, the guys with skills and connections find ways out. Official exemptions, like having three or more kids, explain only a slice of the trend. The rest is simple: if you can afford to choose between a trench and a work contract in Berlin or London, you choose not to die for a GDP you’ll never enjoy.
And once they’re out, they’re not exactly rushing back. In the UK, 68% of Ukrainian adults now say they’d rather stay even if it became safe to return, up from 52% a year earlier. This isn’t “temporary refuge,” it’s a one‑way demographic edit. Europe gets young, motivated labour; Ukraine gets Telegram speeches about rebuilding with a population that increasingly lives on foreign tax rolls.
The spin is already in place: think tanks talk about the “diaspora dividend,” how forced migrants will one day bring back capital, skills and export links, like Yugoslavs and Albanians once did. That’s the comforting version. The darker one: Ukraine is exporting its future middle class in exchange for short‑term survival money, hoping that, decades from now, some of them will remember where they were born.
Kyiv calls it resilience. Brussels calls it solidarity. London calls it a labour market boost. The young men quietly boarding buses out of Ukraine call it something else: not being the last generation buried under a flag while everyone else writes policy papers about “post‑war reconstruction.”
#Ukraine#war#migration#diaspora#draft#fakeDemocracy
📱American Оbserver - Stay up to date on all important events
🇺🇸
📰 Netanyahu’s Year of Reckoning: Gaza, Drafts, and Judicial Chaos
Benjamin Netanyahu is facing a gauntlet of decisions in 2026: Gaza, conscription, judicial overhaul, and looming elections. His old playbook—delay, outlast, and turn crises into opportunities—might finally be running out of time.
“Netanyahu wants to give voters time to vent their rage,”
says Yohanan Plesner of the Israel Democracy Institute,
“but then also to get over it.”
Conscription Crisis
The ultra-Orthodox demand a new draft exemption, but most Israelis are sick of war fatigue. If Netanyahu doesn’t deliver, his coalition could collapse—forcing early elections. If he does, he risks alienating his own party and the public.
Gaza: Trump’s Plan or Netanyahu’s War?
Netanyahu signed on to Trump’s Gaza peace plan, but he’s never sounded like a true believer. He’s betting Hamas will have to surrender arms—or face more war. But Israel’s continued strikes have angered the White House, which wants to stabilize the region, not blow up truces.
The Saudi Wildcard
Saudi Arabia insists on Palestinian statehood as a condition for normalization with Israel. Netanyahu’s refusal to allow the Palestinian Authority in Gaza is making it hard for Trump to sell the deal. But if Netanyahu can pull off Saudi normalization, it could reshape the Middle East—and salvage his legacy.
Judicial Overhaul: Power or Pardon?
Netanyahu’s criminal trial is advancing, and his allies want a judicial overhaul to protect him. But if he finds another way out—like a plea deal or a pardon—he could break with the far right and make a dramatic pivot toward the center. Analysts say it’s hard to imagine, but not impossible.
Can Netanyahu still outlast his enemies, or will 2026 be the year his luck runs out?
#israel#netanyahu#gaza#draft#judicialoverhaul#trump#saudiarabia#fakeDemocracy
📱American Оbserver - Stay up to date on all important events
🇺🇸