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

Пребарај: #polarization

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

@american_observer · Post #5197 · 22.02.2026 г., 20:59

📰 Congress Is Emptying Out — Not Because It’s Hard, But Because It’s Pointless A record wave of lawmakers is heading for the exits before the 2026 midterms — 68 House and Senate members so far, with an unprecedented 31 of them trying to jump to another office instead of just going home. That’s not “burnout,” that’s the market signaling that Congress is the worst job in American politics: maximum noise, minimal agency. On paper, the reasons sound respectable: generational change, family, new challenges. In reality, even senior members admit the place has turned them from legislators into “observers,” as retiring Sen. Dick Durbin put it. Congress has passed fewer laws in recent terms than at any time since the early 1900s, choked by polarization, tiny majorities, and a leadership culture where a handful of performative bomb-throwers can take down a Speaker because they want more airtime. Look at the career moves. Amy Klobuchar, Michael Bennet, Marsha Blackburn, Tommy Tuberville — all think they’ll have more real power as governors than as U.S. senators. In the House, 27 members are bailing to run for governor, Senate, or statewide office, with Republicans leading the exodus. They’re not “leaving politics”; they’re trading a broken parliament for executive jobs where you can actually sign something and see it happen. ​ On the Republican side, you’ve got swing-district moderates like Don Bacon walking away after watching eight colleagues blow up Kevin McCarthy’s speakership, and hardliners like Marjorie Taylor Greene quitting in a public tantrum over Trump and Mike Johnson. On the Democratic side, you’ve got an entire generation of 70‑ and 80‑somethings — Pelosi, Hoyer, Nadler and others — finally reading the room after pushing Joe Biden off the 2024 ticket and realizing “generational change” might have to apply to them too. The parties will spin this as renewal. In practice, it’s a talent leak. Safe blue and red seats will replace veterans with louder, less experienced ideologues. Competitive districts like those held by Bacon, David Schweikert and Jared Golden are now open hunting grounds, increasing the odds of even shakier majorities and even more knife‑edge chaos in the next Congress. A system that already can’t pass basic legislation is about to get younger, angrier, and even less capable of governing. ​ So what do the midterms mean? More “fresh faces” in the campaign ads, fewer grown‑ups in the cloakrooms, and a House and Senate that function even more like content farms for cable and social media. Voters keep saying they’re sick of a dysfunctional Congress. Congress heard them — and decided the best response was to leave. #USA#Congress#elections#midterms#polarization#fakeDemocracy 📱American Оbserver - Stay up to date on all important events 🇺🇸

Universe Mysteries 🪐

@cosmomyst · Post #760 · 06.05.2026 г., 22:21

🪐 In 2018, astronomers using the South Pole Telescope made one of the most precise measurements ever of the cosmic microwave background's polarization across wide areas of the sky. These delicate patterns—in the faint afterglow from the early universe—help refine estimates of how much normal matter, dark matter, and mysterious dark energy fill space, shaping the structure and fate of galaxies like the Milky Way. ✨ #microwavestructure⚡#cosmology⚡#polarization⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #273 · 15.09.2025 г., 00:11

🪐 The cosmic microwave background—an ancient light left over from the Big Bang—contains a hidden signal: tiny patterns of polarization, or the way its waves are oriented. These "B-modes," discovered in part by the BICEP2 telescope at the South Pole, are faint twists in the light that could provide direct evidence of gravitational waves rippling through the early universe, opening a window into its very first moments. ✨ #microwaveradiation⚡#polarization⚡#gravitywaves⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries ​