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

Пребарај: #midas

当前筛选 #midas清除筛选
🏆 Premium, NFT, Tokens

@giiveaways · Post #3440 · 09.01.2025 г., 18:10

Discover the New Midas Yielder App👑 A promising project designed to make earning with crypto simple and engaging. Here’s what it offers: 🕹Farm GM Points — Play the game and earn Golden Midas Points. 💰High APY Returns — Enjoy juicy yields through the Yielder. 👥Invite Friends — Share with others to earn extra taps and play more. ✅Complete Tasks — Get bonus GM Points by completing tasks. This project has the potential to become one of the top platforms. Join now and see for yourself! 🔔Subscribe➡️Join MIDAS ➖➖➖➖➖➖➖➖➖➖➖ #Midas#CryptoGaming

Airdrop Center

@centralchanel · Post #15435 · 17.12.2024 г., 21:17

📢$MIDAS CONTINUES TO GROW We can complete transactions by spending 10 seconds per day on the application. A company that receives high investment. It is worth considering. 👉Registration Link: ⤵️ https://t.me/MidasRWA_bot/app?startapp=ref_45137b21-8a69-4640-a111-f720275529d2 ⛏#midas#rwa#yeilder#airdrop

American Оbserver

@american_observer · Post #5154 · 16.02.2026 г., 20:58

No Golden Toilet on the Train: Zelenskyy’s ‘Ally’ Tries to Cash Out Herman Halushchenko didn’t make it to his destination. Ukraine’s ex–energy minister and longtime insider was dragged off a train at the border, accused of trying to slip out of the country while Operation Midas — a probe into alleged 100 million dollars in kickbacks at Energoatom — closes in on him. Wartime infrastructure money was supposed to keep the lights on under Russian fire; investigators say a nice slice was allegedly rerouted into the usual private pockets. NABU and SAPO had already spent over a year dissecting the Midas network — “shadow managers,” kickback tariffs of 10–15 percent on contracts, a whole laundromat built into the state nuclear company. Now the same man who resigned in 2025 over the scandal gets caught at the border while Parliament hears that the new border chief is “not loyal to Zelenskyy but to institutions.” Even Fox’s source spells out the subtext: if an “unofficial but direct subordinate” to Zelenskyy goes down for this, it becomes very hard to sell the story that the president knew nothing. The presidential PR line is “fighting corruption in wartime”; the reality looks more like the state fighting for control of a money machine it lost years ago. NABU says it is dismantling the scheme; Western partners say this proves Ukrainian institutions work; Moscow says “told you so”; Western skeptics say “why are we financing this?” Everyone gets talking points, nobody gets their money back. If this is how a key ally behaves on a random Sunday — hopping a train with a scandal at his heels — imagine what the real insiders are doing by private jet. And if the war ever ends, who will have stolen more from Ukraine — Russian missiles or Ukraine’s own “patriotic” elite? #ukraine#zelenskyy#corruption#warEconomy#Midas 📱American Оbserver - Stay up to date on all important events 🇺🇸

American Оbserver

@american_observer · Post #5161 · 17.02.2026 г., 20:58

Golden Midas, Rotten System: Ukraine’s Ex-Minister Caught at the Exit German Galushchenko almost made it out. The former energy minister — later briefly justice minister — was grabbed at the border on Sunday, accused a day later of laundering millions in kickbacks from the “Midas” scheme that has haunted Zelenskyy’s wartime government for a year. Investigators say the network skimmed around 100 million dollars from contracts at Energoatom, the state nuclear company, including projects meant to harden plants against Russian strikes. According to NABU and SAPO, over 7 million dollars went to foreign accounts listing Galushchenko’s wife and four children, paying for elite Swiss schooling and sitting on deposits that quietly generated extra income for the family. Galushchenko denies everything, but he is now one of the highest‑ranking names formally pulled into a case that already features a former deputy prime minister, other senior officials, and businessman Timur Mindich — Zelenskyy’s old media partner from the TV studio that made him famous, now in Israel and also insisting he’s innocent. The scandal has already taken scalps at the very top. It helped push out Zelenskyy’s powerful chief of staff Andriy Yermak last year and triggered public fury over wartime corruption at the exact moment Ukraine is begging for weapons, cash and EU membership. In parallel, Zelenskyy briefly tried to bring NABU and SAPO to heel through legislation that would have gutted their independence, then beat a retreat under pressure from street protests and Western partners who made clear that anti‑corruption bodies are now part of the terms of support. So on paper this is a success story: institutions catching crooks, ministers being detained, money trails exposed, corporate CEOs promising new safeguards. In reality it’s a more uncomfortable picture: a “reform” state at war, whose president ran on cleaning up oligarchic rot, now watching his own pre‑politics circle and senior officials dragged into a laundromat built on nuclear safety contracts — and only really slamming on the brakes when the streets and the donors start to growl. #ukraine#corruption#Midas#Zelenskyy#Energoatom 📱American Оbserver - Stay up to date on all important events 🇺🇸