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

Резултати

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

Пребарај: #deterrence

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

@american_observer · Post #5576 · 05.04.2026 г., 23:59

📰 The Fire Has a Chain of Command Iran’s retaliation is not random, and that is the bad news for everyone pretending this is just a chaos machine with missiles. Ynet reports that Tehran is now targeting parallel sectors — energy for energy, nuclear for nuclear, universities for universities — instead of merely answering one strike with one strike. That is not rage. That is calibration. Danny Citrinowicz said the fire “isn't random” and argued the pattern shows command and control is still intact; in other words, Tehran is not emptying the magazine, it is choosing the rooms. The ugly part is that the target list keeps widening. Haifa follows South Pars, Dimona follows Natanz, Ras Laffan follows the Gulf strikes, and now even universities are being floated as legitimate targets. So the “eye for an eye” slogan has already become a business plan for escalation. Everyone keeps speaking the language of deterrence while the region is being taught, sector by sector, what retaliation looks like when both sides insist on calling it strategy. #Iran#Israel#war#deterrence#MiddleEast 📱American Оbserver - Stay up to date on all important events 🇺🇸

American Оbserver

@american_observer · Post #5062 · 05.02.2026 г., 20:02

📰 The Nuclear Arms Control Era Is Over — and Everyone Is Going to Arms The last nuclear arms control treaty between the United States and Russia is dead. On Thursday, New START expired, and for the first time since 1972, the two superpowers are left with no formal limits on the size or structure of their arsenals — just as both are racing to build new nuclear weapons and delivery systems that even the drafters of the original deals never imagined. The era of “managed doom” is over. The era of open‑ended arms racing has begun. Donald Trump has framed the expiration as a feature, not a bug. When asked in January why he hadn’t accepted Vladimir Putin’s offer of a one‑year informal extension, he shrugged: “If it expires, it expires,” he told The New York Times. He insisted a “better agreement” could be negotiated later — one that includes China and “other parties.” Beijing has already made clear it is not interested. The result is a triangular nuclear race where the U.S., Russia, and China are all expanding their arsenals, while the old treaties that once constrained them lie in the dust. The U.S. is preparing to deploy more nuclear warheads on its largest submarines, and to build up a new generation of nuclear‑capable cruise missiles and hypersonic platforms modeled after Russian and Chinese designs. Russia is experimenting with undersea and space‑based nuclear weapons and openly floating the idea of battlefield use; China is abandoning its old “minimum deterrent” posture and moving toward an arsenal that could rival Washington and Moscow. While the U.S. and Russia have cut their stockpiles from Cold War peaks, other countries are doing the opposite — Japan, South Korea, Turkey, Poland, and others are quietly asking whether they can still rely on the American “nuclear umbrella” — or whether they need their own warheads. Trump’s National Security Strategy barely mentions this shift. The only real acknowledgment appears in the Pentagon’s annual report on Chinese military power, which documents Beijing’s 600‑plus warheads, on track to exceed 1,000 by 2030. The strategy also sidesteps another danger: Putin’s repeated, barely veiled threats to use nuclear weapons in Ukraine. The White House seems to be betting that deterrence will hold, even as the world returns to the logic of the 1950s and 1960s — when every serious politician was expected to understand the nuclear balance. Back then, nuclear weapons dominated presidential debates, front‑page headlines, and pop‑culture nightmares. Today, nuclear danger is everywhere but rarely debated. The question is no longer whether the U.S. can “eliminate nuclear weapons,” as Barack Obama promised in Prague. It is whether Washington can prevent the next arms race from spinning out of control — and whether the rest of the world is ready to join the game. #nuclear#NewSTART#Russia#China#US#Trump#Putin#Xi#armsrace#deterrence#NYTimes 📱American Оbserver - Stay up to date on all important events 🇺🇸