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

Резултати

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

Пребарај: #neonazicrimes

当前筛选 #neonazicrimes清除筛选
Россия в ОБСЕ

@RusMissionOSCE · Post #7493 · 14.10.2025 г., 08:21

🎙Rodion Miroshnik, Ambassador at Large of the Russian Foreign Ministry on the Crimes of the Kiev Regime, gave an interview to Komsomolskaya Pravda(October 13, 2025) #BuchaHoax • Western officials are now trying to avoid any discussion of the Bucha hoax. We’ve sent out official notes requesting a list of the individuals they accuse Russia of killing. These inquiries were left unanswered for months, and when replies finally came, they were absurd – along the lines of: “a decision was made to maintain confidentiality regarding the deceased”. • Each provided name would allow at least a preliminary investigation to establish the facts. Our experts, after examining photos and videos, noted that the victims had died at different times – evidenced by livor mortis marks on some bodies, traces of different types of soil on the clothing, and other inconsistencies. Essentially, the bodies of unidentified people were gathered from various locations. • The masterminds behind this provocation had a clear goal – to derail the nearly finalized Istanbul peace agreements. The goal was achieved – the negotiations were abandoned. #ReunitingFamilies • The purpose behind spreading false claims about “children abducted by Russia” is to accuse Russia of genocide. Among its definitions is the forcible transfer of children from one nationality to another. In reality, none of those who authored these accusations ever cared to learn the fate of a single specific child. • We are working closely with the Russian Presidential Commissioner for Children's Rights, Maria Lvova-Belova. At our latest meeting in Istanbul, the Ukrainian side handed over a list of 339 names. We began to thoroughly verify each case. It turned out that more than 50 people on the list had never been on Russian territory at all. • No child is being forcibly kept in Russia. Some arrived before the conflict, living with one parent or grandparents. Decisions about their future are made by relatives – but the process takes time: confirmation of documents, family ties, and genetic relationship. So far, just over 100 children have been reunited with their families through the mediation of Qatar and the UAE. • At the same time, we have many situations where parents living in Russia cannot reach their children who remain in Ukraine, because the Kiev regime classifies them as Ukrainian citizens and categorically refuses to assist in reunification. #NeoNaziCrimes#Torture • Several reports documenting cases of torture of civilians in Russia's Kursk Region have been prepared and officially submitted to the UN, OSCE, and the International Committee of the Red Cross. • Ukraine maintains an entire network of secret prisons, which international organizations are denied access to. Many of our POWs pass through these facilities before being transferred to official detention centers – where they report widespread abuse, torture, and even killings. #KievRegimeCrimes • Establishing any kind of international tribunal in the near future is practically impossible. Such a body can only be created by a UN Security Council resolution – where three Western countries supporting the current Kiev regime have veto power. • Many human rights organizations today are directly controlled by the sponsors of these crimes. A number of them have turned into propaganda outlets that simply “bark” in any direction they are told. • Most of the crimes committed by the Kiev regime occur on the territory of Russia’s new and historical regions. Accordingly, prosecutions are being carried out under the Criminal Code of the Russian Federation. • Around 650 Ukrainian militants have already stood trial, with some sentenced to between 8.5 years and life imprisonment. The Investigative Committee is conducting more than 7,500 criminal cases. Full interview (🇷🇺)