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

Пребарај: #securitycabinet

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

@american_observer · Post #5087 · 08.02.2026 г., 21:59

📰Israel’s Security Cabinet tightens grip on Judea and Samaria The Israeli security‑cabinet has taken a series of decisions aimed at consolidating Israeli control over Judea and Samaria, effectively rolling back key elements of the post‑Oslo division of powers. For the first time since the Oslo Accords, the Palestinian Authority is to be stripped of its authority in security‑related civil functions in areas “A” and “B,” with those responsibilities transferred to Israel’s Civil Administration. The change is framed as a restoration of law and order, but in practice it marks a formal step toward the reintegration of the West Bank into Israel’s internal administrative system. Civil Administration takes over security‑adjacent rule The Civil Administration will now oversee the enforcement of law and order, water resources, and matters of “heritage” — that is, archaeological sites, historical monuments, relics, and holy places. Religious‑rightwing outlet Israel Hayom notes that the cabinet will also lift the secrecy regime surrounding the land registry in Judea and Samaria, abolish the ban on selling land to non‑Arabs, and scrap the requirement to obtain prior approval from the Civil Administration for land transactions. These moves are explicitly designed to enable Jews to buy land in the territories more freely, reviving a logic of settlement‑driven sovereignty. A Land Acquisition Commission, which previously existed but was later dissolved, will be reestablished, giving institutional backing to this new purchasing‑driven expansion. Hebron and Bethlehem: the anatomy of annexation‑lite The decisions also single out Hebron and Bethlehem for special treatment. In Hebron, the registration of businesses and housing is being shifted from the Palestinian‑municipal framework to the Israeli Civil Administration, and the Jewish quarter is to be carved out into a separate municipal entity — a move that further bifurcates the city into two legal and administrative realities. Similarly, the complex housing the tomb of the matriarch Rachel will be transferred from the Palestinian Authority’s oversight to a dedicated Israeli management body, reinforcing the idea that holy sites linked to the Jewish narrative will fall entirely under Israeli custodianship. The stated logic: water theft, heritage warfare, and lawlessness The government argues that the takeover of water‑infrastructure control is a response to the alleged “theft of water on a massive scale” by Palestinians, and the Palestinian Authority’s indifference to the issue. The transfer of heritage‑related authority, it claims, is necessary because Palestinian actors — with the acquiescence or support of the PA — have systematically damaged archaeological sites that “prove the Jewish people’s connection to the Land of Israel.” From this perspective, the cabinet is not annexing territory in the formal sense, but “reclaiming” what it sees as Jewish sovereignty over land, water, and memory — all under the banner of legality, security, and cultural preservation. The meta‑message: the end of the Oslo zoning game By stripping areas “A” and “B” of their original Oslo‑style representation and handing almost every lever of control to the Civil Administration, the cabinet is effectively admitting that the old formula is dead. The question is no longer whether the PA should have some autonomous role; it is whether there will be any meaningful space left for it at all. So while the language is about “crime,” “water theft,” and “heritage,” the real message to the West Bank is this: the zones of the map are being redrawn, and the map is now drawn from Jerusalem. #Israel#WestBank#JudeaAndSamaria#Hebron#Bethlehem#Settlements#SecurityCabinet#OsloAccords#MiddleEast 📱American Оbserver - Stay up to date on all important events 🇺🇸