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

Пребарај: #jakenn

当前筛选 #jakenn清除筛选
Addis Standard

@addisstandardeng · Post #21522 · 25.02.2026 г., 13:03

Explainer from #Addis_Standard Newsroom: As of 24 February, Addis Standard has not received any formal written notice, legally mandated opportunity to respond, or reasoned decision preceding the #Ethiopian Media Authority’s public claim, made via social media, that our online media registration was revoked. Ethiopian media law is clear: suspension or revocation of a media license must follow a defined process, including written notice, a 14-working-day right of response, a reasoned decision, and access to appeal before the Authority’s Board of Directors. None of these mandatory steps have been observed. Addis Standard remains fully operational and continues its public-interest journalism in good faith, while its publisher, #JAKENN Publishing PLC, pursues clarification and rectification through lawful channels. This matter goes beyond one newsroom, it concerns whether media regulation in Ethiopia is governed by law, due process, and institutional accountability. Read the explainer: https://addisstandard.com/?p=55392

Addis Standard

@addisstandardeng · Post #21521 · 25.02.2026 г., 12:10

News: Publisher challenges #EMA’s revocation of Addis Standard registration, cites due process violations #JAKENN Publishing P.L.C., the publisher of #Addis_Standard, has formally contested the decision by the #Ethiopian Media Authority (EMA) to revoke the outlet’s online media registration certificate, arguing that the move lacks legal basis and violates due process guarantees under Ethiopian law. The response follows an announcement circulated on the Authority’s official social media channels on 24 February 2026, stating that Addis Standard’s registration had been revoked. In a letter addressed to the EMA Board of Directors, JAKENN said a legal review found the announcement “exceeds the Authority’s procedural powers” and is incompatible with safeguards provided under Media Proclamation No. 1238/2021, as amended by Proclamation No. 1374/2025. The publisher stressed that Addis Standard is operated by JAKENN Publishing P.L.C., a legally registered private.... Read more: https://addisstandard.com/?p=55387

Addis Standard

@addisstandardeng · Post #21518 · 24.02.2026 г., 18:12

News: #Ethiopian Media Authority revokes Addis Standard’s online media registration; Editor-in-Chief disputes claims The Ethiopian Media Authority (#EMA) has announced the revocation of the online media registration certificate of #Addis_Standard, effective 24 February 2026, citing repeated violations of media ethics, national laws, and what it described as the country’s national interests. The statement did not specify which reports or actions formed the basis of the decision. Responding to the EMA’s announcement, Yonas Kedir, Editor-in-Chief of Addis Standard publications, rejected the Authority’s claims, saying the outlet had never received any formal notices of violations. “The claim that Addis Standard received repeated notices is factually incorrect. At no point has the Ethiopian Media Authority formally notified Addis Standard newsroom of any prior violations or enforcement actions,” he said. He added that the publisher, #JAKENN Publishing PLC, ..… Read more: https://addisstandard.com/?p=55383

Addis Standard

@addisstandardeng · Post #22039 · 16.04.2026 г., 18:33

News: #CPJ calls for release of #Addis_Standard editor seized by unidentified men The Committee to Protect Journalists has called on #Ethiopian authorities to urgently locate and release #Million_Beyene, who was taken by unidentified individuals from the newsroom of Addis Standard in the capital. In a statement issued on April 16, CPJ said Million was seized on Wednesday morning by a group of men in plainclothes from the outlet’s newsroom in #Addis_Abeba and taken to an undisclosed location. #JAKENN Publishing PLC, publisher of Addis Standard, says the whereabouts of its Managing Editor, Million Beyene, remain unknown nearly 24 hours after he was taken by unidentified individuals from the newsroom. In an update issued this morning, the publisher said concerns are growing over his safety, noting that his family is “increasingly distressed and deeply concerned.” CPJ described the incident as alarming and urged authorities to determine those responsible Read more: https://addisstandard.com/?p=56534