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

Пребарај: #ring

当前筛选 #ring清除筛选
Libreware

@libreware · Post #1541 · 10.02.2026 г., 21:04

Super Bowl Ad TRICKING You Into Welcoming Surveillance State! During the Super Bowl, you may have seen a commercial for #Amazon’s #Ring “Search Party” feature, which uses an emotional lost-dog story to encourage adoption of participation in what amounts to a widespread neighborhood #surveillance net. Jimmy points out that the ad masks #privacy risks tied to AI-driven #cameras, data sharing, and Amazon’s broader surveillance ecosystem, including concerns about opt-out defaults and government access. He and Americans’ Comedian Kurt Metzger expand the discussion into a broader critique of social media and smart devices as tools of self-surveillance, suggesting public safety and convenience are being used to justify constant monitoring. Ultimately, it frames the commercial as emblematic of a growing surveillance state presented as benevolent technology. https://www.youtube.com/watch?v=5AJtRDjoXN4 #why

Russian Consulate in Cape Town

@rusconct · Post #2211 · 03.02.2025 г., 06:01

#Victory80 🌟 February 2, 1943, one of the most brutal battles of #WWII and all of history — the Battle of Stalingrad — concluded. For 2️⃣0️⃣0️⃣ days and nights the Battle of Stalingrad raged on the banks of the Don and the Volga rivers, and in the city proper, or rather what was left of it following merciless Nazi bombardments and stubborn defender fighting for every street, alley and house. The battle itself surpassed in scope and intensity all prior battles of #WWII. During that battle, more than 2.1 million people fought on both sides. By the end of June 1942, the Nazis concentrated in the strip of land from Kursk to Taganrog on the front of 600-650 kilometers up to 35% of infantry, over 50% of armour and motorized divisions of the total number of Wehrmacht troops deployed on the Soviet-German front. During the planning of the Stalingrad operation, the enemy had several objectives: to gain a foothold on the Volga River and thus deprive the #SovietUnion of control over one of the most important transportation arteries of the country. The capture of #Stalingrad, according to the assessment of the Nazi military command, would open the way for the Wehrmacht to the Caucasus, where the Germans hoped to obtain the most important resource for making the war machine continue — oil fields. Traditionally, according to the historians, the Battle was divided into two stages: • Defensive phase: from July 17 to November 18, 1942; • Offensive phase: from November 19, 1942 to February 2, 1943. During the first stage, July 17 - November 18, 1942, the Red Army had to conduct defensive operations and engaged the enemy in fierce street battles directly in the city. The forces of the 62nd and 64th Soviet armies, led by Vassily Chuikov, commander of the 62nd Army, engaged the troops of the 6th Army of the Wehrmacht under the command of Lieutenant General Paulus. By mid-November 1942, as a result of stubborn resistance and the deployment of the Red Army reserves favorable conditions were created for launching the counteroffensive. The plan for the operation code-named#Uranus was developed under the leadership of Army General Georgy Zhukov and Colonel General Alexander Vasilevsky. During the large-scale counteroffensive at Stalingrad (November 19, 1942 — February 2, 1943), Soviet forces conducted the operation #Ring, during which the Red Army managed to drive Paulus's 6th Army into a “cauldron” between the Don and Volga rivers. Realizing the futility of further action, by the end of January the Nazi units began to surrender en masse. On January, 31, General Paulus (promoted by Hitler to to General-Field Marshal), together with other German generals and officers at Stalingrad finally surrendered. OnFebruary 2, the last pockets of Nazi resistance were eliminated. The #BattleOfStalingrad ended with a complete victory of the Red Army. For the first time ever the all-consuming Nazi war machine was weighed, measured and found wanting. This marked a turning point not only in the the Great Patriotic War, but that of the entire #WWII. In Stalingrad, Wehrmacht and its auxiliary forces from the Axis lost 1/4 of all troops deployed by the Reich on the Eastern front. Total enemy losses amount to ~1.5 million soldiers and officers. From that moment forward thestrategic initiative was on the side of the Red Army. The Victory in Stalingrad created favourable conditions for further full-scale counteroffensive of Soviet forces to expel the enemy from the Nazi-occupied territory of the USSR. 🌐 The defeat of the bulk of the enemy troops not only shocked the world and significantly raised the international prestige of the Soviet Union and its Armed Forces, but also contributed to the strengthening and tightening of the anti-Hitler coalition. 🎖 Victory in the Battle of Stalingrad was in large achieved through superior strategy and tactics, but also due to mass heroism of Soviet soldiers, officers and hard work of all those on the home front. 112 participants of the Battle were awarded the title of the Hero of the Soviet Union. #WeRemember