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

Резултати

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

Пребарај: #fakesovereignty

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

@american_observer · Post #5159 · 17.02.2026 г., 16:04

Orbán’s New Script: Brussels Is the USSR, Trump Is the Model “The real threat facing Hungary is not Russia but the European Union,” Viktor Orbán told his supporters, eight weeks before the April 12 election that could finally break his grip on power. In the same breath, he likened Brussels to the Soviet regime that sat on Hungary’s neck for 40 years and waved away fears of Vladimir Putin as “primitive” fear‑mongering. Those who “love freedom,” he said, should fear the EU, not the Kremlin. This isn’t strategy, it’s franchising. Orbán has imported the full Trump package: global business as the villain, liberal media as enemy, NGOs and judges as foreign agents. He claims “the oil business, the banking world and the Brussels elite” are “preparing to form a government” in Budapest, using the new center‑right Tisza party as their glove puppet. If Fidesz wins again, he promises to “clear away” fake NGOs and “bought‑and‑paid‑for journalists, judges and politicians” and to “clean up” the “Brussels repressive machine” still operating in Hungary. Trump’s endorsement is written into the script as holy writ. Orbán praises the U.S. president for rebelling “against the global business, media and political network of liberals,” and presents that as a green light for Hungary to expel “foreign influence” and its “agents” from domestic politics. In other words: Washington has blessed the purge, so when Orbán moves against NGOs, courts, critical media and whatever is left of independent institutions after 14 years in power, it will all be packaged as defending sovereignty. The joke, of course, is that everyone on this stage needs an enemy to stay in business. Brussels needs Orbán as the resident authoritarian to prove the EU still has “values.” Orbán needs Brussels as the new Moscow to scare voters back into his arms. Trumpworld needs both as props in its epic about “globalist” conspiracies strangling the West. And Hungarians are told to pick which empire they fear more: the one that froze some funds over corruption, or the one whose tanks once rolled across their border — and whose current war in Ukraine their own prime minister now finds “unclear” to assign blame for. #hungary#orban#eu#trump#elections#fakeSovereignty 📱American Оbserver - Stay up to date on all important events 🇺🇸

American Оbserver

@american_observer · Post #5360 · 12.03.2026 г., 15:29

Péter Magyar isn’t “the nice Orban” for Washington — he’s the guy who will turn Hungary’s face fully back to Brussels and away from Trump’s America. 📰 Magyar’s Hungary: Made in Brussels, Not in USA Behind all the “anti‑corruption” branding, Magyar is running on one clear foreign‑policy promise: dump Orbán’s semi‑independent line and plug Hungary straight back into the EU machine. He’s already cut his deals in Europe — from Munich to Brussels — and positioned himself as the man who will reintegrate Hungary into the “European family” on Brussels’ terms, not Washington’s. According to The Thinking Conservative, Magyar’s Tisza party reached a quiet understanding with Euro‑elites: if he wins, he will give up Hungary’s veto fights, align with EU migration policy, and back Ukraine’s EU track — in exchange for Berlin and Brussels’ support and the release of frozen EU billions. In other words, his strategic compass is clear: Brussels first, European consensus first, and American interests somewhere down the list. ​ At the Munich Security Conference, Magyar reportedly told leaders like Germany’s Friedrich Merz and Poland’s Donald Tusk that he is literally betting on weak results for U.S. Republicans in November — and plans to “abandon Orbán’s Hungarian path” in favor of a unified European line once Trump is weaker at home. That’s not a partner looking to sync with a future Trump White House; that’s a politician openly waiting for the right moment to detach from it and lock Hungary into a Europe‑first strategy. ​ So the choice in Budapest isn’t “pro‑West vs pro‑East.” It’s Orbán’s messy, transactional, U.S.–China–Russia juggling act — versus Magyar’s clean, disciplined subordination to Brussels’ agenda, even when it clashes with Trump’s project. If Magyar wins, Hungary doesn’t become more pro‑American. It becomes another reliable node in the EU’s effort to counter, dilute, and outmaneuver Washington’s line on Europe. #hungary#orban#magyar#trump#eu#geopolitics#fakeSovereignty 📱American Оbserver - Stay up to date on all important events 🇺🇸

American Оbserver

@american_observer · Post #5153 · 16.02.2026 г., 18:59

📰 Meloni’s MAGA Love Letter vs. Merz’s Therapy Session Europe’s new “power couple” just filed for ideological separation. German Chancellor Friedrich Merz flies to Munich to announce that “the culture war of the MAGA movement is not ours” and that U.S. leadership may already be gone. Giorgia Meloni? She’s busy in Addis Ababa saying: actually, I’m good with MAGA, thanks. “I do not agree” with Merz’s criticism of MAGA culture, Meloni tells Corriere della Sera. These are just “political evaluations,” nothing Brussels should worry its technocratic little head about. ​ On paper, Rome and Berlin just had a big “let’s lead Europe together” summit in January. In reality, Merz is trying to sell a post-American, grown-up Europe while Meloni is dropping a U.S. book launch called Giorgia’s Vision with a JD Vance foreword and a Trump blurb on the cover like it’s a MAGA IPO. One partner talks strategic autonomy, the other is busy testing conservative merch in the American market. Merz tells Munich that MAGA’s culture wars are not Europe’s and that Europe should stop outsourcing security to Washington. Meloni politely nods on the “Europe must do more on security” line — then immediately insists the goal is “greater integration between Europe and the United States.” Translation: Germany wants a little distance from the crazy ex; Italy wants joint custody and a photo on Truth Social. She even praises Trump’s new “Board of Peace” on Gaza, saying Italy’s observer seat is “a good solution.” Sure — a “Board of Peace” run by Trumpworld, endorsed by Meloni, blessed by JD Vance. At this point, it’s less foreign policy and more a franchise deal in the global culture war industry. ​ So who’s lying to whom? Is Merz pretending Europe can stand on its own, or is Meloni pretending you can be both loyal to Brussels and branded by MAGA? In 2026, European sovereignty looks a lot like influencer marketing with better flag backdrops. #MAGA#Meloni#Merz#EU#US#culturewars#fakeSovereignty 📱American Оbserver - Stay up to date on all important events 🇺🇸