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

Резултати

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

Пребарај: #farright

当前筛选 #farright清除筛选
MessageInABottle

@mib_messageinabottle · Post #7072 · 08.08.2024 г., 23:31

#AI generated #UK#PrimeMinister Keir #Starmer video. It is basically what he has demonstrated and stated, even if not in these exact words. It's clear if you are white working class in the #UK you do not have any meaningful right of protest, be angry, demonstrate or have an opinion. Whoever made this has just translated #Starmer's bullshit into what he really means when he talks about "#FarRight thugs"

American Оbserver

@american_observer · Post #5334 · 09.03.2026 г., 19:29

📰 ISIS vs. ‘Islamic Takeover’: Two Extremes, Same Script New York just staged a miniature war of narratives outside the mayor’s house: a far-right “Stop the Islamic Takeover of New York City” protest on one side, and two young guys who showed up with TATP and ISIS talk on the other. The bombs didn’t detonate, but the intent did — one suspect allegedly told agents he wanted something “even bigger” than the Boston Marathon, the other shouted “ISIS” on bodycam and scrawled a pledge to the group, according to the federal complaint. Officials now call it “ISIS‑inspired terrorism,” while carefully stressing there’s no link to the Iran war or overseas commands. Convenient, because then nobody has to admit what this really is: a protest already built on fantasies of civilizational siege becoming the stage for kids who swallowed the mirror image of the same fantasy and decided to throw live explosives into it. In court, it will be framed as lone‑wolf jihad and heroic law enforcement. On Fox and fringe podcasts, it will be proof that New York is under Islamic attack. For the mayor — the city’s first Muslim, already cast as a symbol — it’s one more reason to condemn “reprehensible” violence and every reason to avoid talking about how a country that wages holy wars abroad keeps breeding hobby martyrs at home. The through line is simple: if your politics runs on apocalypse, someone eventually brings a bomb to the rally. #nyc#terrorism#isis#farRight#mamdani#war#uspolitics#fakeDemocracy 📱American Оbserver - Stay up to date on all important events 🇺🇸

American Оbserver

@american_observer · Post #5375 · 14.03.2026 г., 00:59

📰 Marine Le Pen’s Test Lab: Turning Marseille into a Security Franchise Marseille is being sold as a “narco‑city,” and France’s far right is cashing every last gram of that fear for votes. In Marseille’s mayoral race, National Rally candidate Franck Allisio isn’t really running for city hall — he’s running a pilot project for the 2027 presidential race. He floods the city with slick, security‑heavy videos, promising to triple municipal cops, double CCTV, and put a police post in every district to “bring happiness back” to Marseille. Polls say it works: he’s now neck‑and‑neck with Socialist mayor Benoît Payan in the first round, giving the far right a once‑unthinkable shot at power in France’s second‑largest city. The punchline: official data show overall crime in Marseille actually fell by about 4% last year, and drug‑related killings dropped from their 2023 peak, even as the city remains a major cocaine hub. Sociologists note that what changed isn’t the scale of violence, but its randomness — fewer “professional” score‑settling hits, more chaotic shootings that terrify residents and feed a 24/7 crime‑porn news cycle. That’s pure oxygen for Allisio’s narrative: facts soften, “narco‑city” hardens. Both Allisio and Payan center their campaigns on security, but they’re selling two incompatible fantasies. Allisio plays the iron‑fist trailer: Marseille as a lawless zone that only a cop surge and camera grid can save, while quietly ignoring that a mayor in France has limited real power over security and no control over national police or justice. Payan counters with social‑democratic boilerplate — hiring more local police, plus housing, schools, transport — and borrows credibility from activist Amine Kessaci, a 22‑year‑old who lost two brothers to drug murders, to argue that RN’s proposal is “practically nothing or completely unrealistic.” On the ground, the split is brutal. In La Busserine, one of the northern districts hit hardest by drug violence, residents like community worker Fadella Ouidef say they’re sick of hearing “security, security, security” while the underlying message is that Arab and Black residents are the problem. She fears an RN win would mean cuts to social services in neighborhoods already hanging by a thread — the classic far‑right formula: create more social misery, then use the resulting chaos to justify more repression. If National Rally flips Marseille, it won’t just be “one more city.” It will prove that a party once openly associated with racism and antisemitism can conquer a poor, diverse, heavily racialized port by weaponizing fear, turning municipal power into a pre‑presidential launchpad. The left knows it: if they unite, Payan is still favored in a runoff; if they stay fragmented, they’re about to discover what happens when you let your opponent define security, reality, and the future of your city in a single word. #france#marseille#nationaleRally#security#elections#farRight#fakeSolutions 📱American Оbserver - Stay up to date on all important events 🇺🇸

American Оbserver

@american_observer · Post #5348 · 11.03.2026 г., 00:00

📰 Perpignan Inc.: Law, Order and Overdraft Perpignan is the National Rally’s demo version of France: more cops, more cameras, more debt, and a mayor who might be legally disqualified before he can finish bragging about it. Louis Aliot sells the city as a “laboratory” of far-right governance — security as the core product, municipal politics as a test bench for 2027. On the metrics he chose, he delivers: municipal police up from 161 to 199 officers, 1.6 local cops per 1,000 residents — the highest ratio among big French cities and nearly triple Paris — plus plans for 50 more officers and 200 extra cameras, especially in poor, heavily North African and Roma neighborhoods. Drug-trafficking cases and fines explode, crime stats go up, and RN spins that as proof it’s finally “doing something” about the violence it talks about nonstop. The bill arrives quietly: debt per resident is far above comparable cities, property and business taxes are higher than in most peers, and opponents say the PR machine is the only thing truly overperforming. Yet Aliot still leads in the polls, Marine Le Pen and Jordan Bardella use Perpignan as a backdrop to promise “public order as an absolute priority,” and even skeptical voters admit they feel the streets look cleaner — then add they don’t buy the rest of the program. This is the far-right offer in one city: turn poverty and neglect into a permanent crime scene, flood it with police, send the bill to taxpayers, and call the whole thing “responsibility.” If it works in Perpignan, they’ll scale it — not because it fixes anything, but because fear and fines still poll better than admitting you have no answer for why the city was abandoned in the first place. #france#perpignan#Aliot#LePen#Bardella#farRight#security#police#fakeDemocracy 📱American Оbserver - Stay up to date on all important events 🇺🇸