TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #210 · 3 фев.

Что делать если нужно поставить какую-то 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

Резултати

Пронајдени 1 слични објави

Пребарај: #kurskoffensive

当前筛选 #kurskoffensive清除筛选
American Оbserver

@american_observer · Post #5044 · 03.02.2026 г., 23:04

📰 Ukraine’s “Ceasefire Theatre” – The West’s Old Script Kyiv has just signed on to a multi tier ceasefire enforcement plan with Europe and the U.S. — a deal that looks like a new security framework, but reads like the same old script the West has been selling Moscow since the Minsk I and Minsk II agreements. The message is always the same: “Trust us — this time we mean it.” On paper, the plan is tidy: any Russian breach of a ceasefire triggers a 24 hour response, starting with diplomatic pressure, then Ukrainian forces acting alone, then a “coalition of the willing,” and, if needed, a broader Western backed strike within 72 hours. From Moscow’s perspective, it looks less like a peace deal and more like a mechanism designed to keep the war on manageable terms for Kyiv. ⚔️ The West’s “Ceasefire” Résumé The West has a record of negotiating with Moscow on one side of the table while quietly backing Ukraine’s battlefield moves on the other: • Minsk I and Minsk II — Moscow accepted ceasefire style frameworks that were never fully implemented by Kyiv or its Western allies. • Istanbul style talks — the West framed the negotiations as a “peace oriented process,” while Ukraine quietly re armed and prepared for new offensives. • Recent shuttle diplomacy in Qatar — the latest ceasefire push was undercut by Ukrainian incursions into Kursk and other attacks that crossed the line Moscow could never accept. Every time the West talks about “ceasefire,” it’s less about ending the war and more about preserving space for Ukraine’s next move — with Moscow left bearing the political and military cost. 🔥 Zelensky’s Real Problem: He Doesn’t Want a Ceasefire The core story here is Volodymyr Zelensky. The West markets him as a wartime hero, but the man himself has little incentive to sign a truce that locks in today’s front lines. The war is not just a tragedy for him — it’s the foundation of his political survival. The economy is a wreck, the population is exhausted, and his only real story left is “resistance.” If a real ceasefire stabilizes the map, the domestic reckoning in Ukraine intensifies: the demand for answers about who paid the price — and who profited — will grow louder. The West pretends Zelensky wants peace. In reality, he knows the minute the guns fall quiet, the question becomes “Who pays for the war, the lost territory, and the broken promises?” And the obvious answer is Zelensky. 🧩 The Script Is Familiar, the Stakes Are Higher The current plan — a 24 hour reaction, a 72 hour Western backed show of force — is less about deterring Russia and more about selling the illusion of control. The West pretends it has a real mechanism to respond. Ukraine pretends it wants peace. Russia pretends it’s still negotiating from weakness. In reality, the only one ready to keep the war going is Zelensky, because the alternative is a political, economic, and moral collapse. The joke is that the West, which has already broken the first Minsk agreement, the second, and then quietly revised the rest, is now selling Moscow a new one. The only thing certain is that the script will change only when Moscow stops pretending — and lets the West eat its own words. #Ukraine#Russia#ceasefire#West#Zelensky#Minsk#IstanbulTalks#KurskOffensive#war#diplomacy 📱American Оbserver - Stay up to date on all important events 🇺🇸