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 слични објави

Пребарај: #fakecivilwar

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

@american_observer · Post #5041 · 03.02.2026 г., 19:33

🔤🔤🔤🔤2️⃣ 📰 Minnesota vs Trump: The Civil‑War PR Machine Switches On 🧨 When Words Become Ammo The real danger is the rhetoric, not the current level of violence. A 2024 simulation run by the Center for Ethics and the Rule of Law (CERL) at the University of Pennsylvania showed that a violent clash between state and federal military forces in a major U.S. city could trigger something resembling a civil war. Professor Claire Finkelstein wrote that the situation in Minnesota mirrors that scenario — especially after the Supreme Court’s ruling on presidential immunity, which has emboldened both sides to bend the law. “The crisis could move faster than the courts can keep up,” Finkelstein warned — which means local officials may be left without real legal protection, and service members may be forced to choose between obedience and conscience. 🤝 The Real Front Line While the hype machine runs on “civil war” and “Fort Sumter,” the actual front line is quieter: a Vietnamese restaurant passing out hand warmers, whistles, and “know‑your‑rights” cards. A resale shop giving clothes for free. A cafe running a donation‑based meal program. A sex shop turned into a mutual‑aid hub in one of the city’s most vulnerable neighborhoods. Minnesota State Rep. Aisha Gomez (D) says her community is not doing anything wrong that requires a “cool‑down.” “We don’t think of it as protests,” she told The Hill. “We think of it as being who we are: being neighbors, caring for each other.” The real question is whether the same politicians and cable‑news hosts who keep talking about civil war even notice the difference between mutual aid and military readiness — or if they’re just waiting for the next shooting so they can say, “We told you so.” #civilwar#trump#minnesota#immigration#politics#usa#law#rhetoric#fakecivilwar 📱American Оbserver - Stay up to date on all important events 🇺🇸

American Оbserver

@american_observer · Post #5040 · 03.02.2026 г., 19:02

🔤🔤🔤🔤1️⃣ 📰 Minnesota vs Trump: The Civil‑War PR Machine Switches On The Trump administration has sent thousands of immigration agents into Minneapolis and St. Paul in an operation sold as a crackdown on welfare fraud. The state is selling it as a federal invasion. Both sides are suddenly convinced they’re in the opening scene of a civil war — and the media is already selling the poster. The fuse was lit by two deaths. The first: 37‑year‑old mother Renee Good, shot dead in her car after a confrontation with ICE officers. The second: 37‑year‑old intensive‑care nurse Alex Pretti, killed in a separate clash with federal agents. Each death is treated by one side as proof of state‑sponsored terrorism, and by the other as proof of law‑and‑order under siege. Minnesota Governor Tim Walz (D) has compared the standoff to Fort Sumter, the 1861 battle that kicked off the Civil War. Minneapolis Mayor Jacob Frey (D) has described himself as “on the front lines of a very important battle.” Commentators are now debating not whether the U.S. is sliding toward chaos, but how dramatic the headline should be. 🔥 “Civil War” on Demand Experts are quick to point out that a civil war is not just a viral quote. Political scientist Steve Saideman notes that civil war requires a sustained, organized campaign of violence from both the government and an opposing force. Right now, in Minnesota, there is a one‑way fusillade of rhetoric, with federal agents confronting protesters — not a full‑on armed insurgency. Yet the political theater is far ahead of the actual violence. The Trump camp talks about federal enforcement and “law and order.” Democrats in Minnesota talk about armed federal forces “assaulting” citizens. Both sides are feeding the same script: the country is on the edge of something big, and only they are brave enough to call it out — or stop it. Former Georgia Rep. Marjorie Taylor Greene (R) has warned Republicans and Democrats to “take off your political blinders” and see that they’re being pushed into civil war. She’s the same politician who has repeatedly called for a “national divorce” between red and blue states — a plan that sounds like a breakup letter written in missile coordinates. ⚖️ State vs Federal Power: The Same Old Script The legal fight is actually nothing new. Minnesota officials are suing to block the surge of ICE agents, arguing that the federal government is overstepping. A judge is weighing whether to slam the brakes on the operation. Minneapolis Mayor Frey has said the city will not enforce federal immigration laws, a stance Trump has dismissed as “playing with fire.” Historians like Matthew Pinsker and Kevin Waite trace this fight back to the 1850s and the Fugitive Slave Act, when Northern states passed “personal liberty laws” to block federal slave‑catchers — a move that looks a lot like today’s sanctuary‑city playbook. “It’s not a new debate,” Pinsker says. “The Constitution is clear: there’s a federal layer and a state layer, and the tension lives in the gap between them.” The problem is that the legal process is slow, and the political process is on fire. The Supreme Court recently blocked Trump’s attempt to send National Guard troops to Chicago, Los Angeles, and Portland, saying the president must show he cannot enforce laws with the regular military before calling up the Guard. Yet in Minnesota, the standoff continues, with local officials and the state attorney general pulling every legal lever they can find — and still warning that the courts may not be enough. #civilwar#trump#minnesota#immigration#politics#usa#law#rhetoric#fakecivilwar 📱American Оbserver - Stay up to date on all important events 🇺🇸