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

Резултати

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

Пребарај: #derg

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

@addisstandardeng · Post #22037 · 16.04.2026 г., 12:58

#Op_ed: Historical Divides, Emerging Alliances: Shifting politics, rising hopes for dialogue in #Ethiopia Ethiopia’s political crisis reflects not just a struggle for power but “fundamentally conflicting narratives about the country’s formation,” centered on Menelik II, writes Yaekob Yatene. One view sees expansion as “reunification,” while another defines it as “conquest.” These competing narratives have shaped modern politics and institutions. While the #Derg’s “Land to the Tiller” addressed inequality, and ethnic federalism enabled self-rule, both failed to resolve deeper demands for autonomy. Yaekob notes a shift: #Amhara actors now prioritize “the protection and survival of the Amhara,” even exploring “collaboration on the ground” with former rivals. He argues this “decoupling…from pseudo-unionist ideological control” could open space for “interest-based engagement.” https://addisstandard.com/?p=56531

Addis Standard

@addisstandardeng · Post #21469 · 20.02.2026 г., 10:44

#Op_ed: #TPLF at 51: Legacy of transformation, contention On 18 February 2026, the #Tigray People’s Liberation Front (TPLF) marked its 51st anniversary, which Ewnetu B. Debela calls “a milestone," highlighting its role as a "primary architect of the modern state" and “a deeply polarizing force.” Since its 1975 insurgency origins, the TPLF has evolved from a guerrilla movement into a governing elite, overthrowing the #Derg regime and overseeing decades of "sustained economic growth" and infrastructural expansion. Critics note a "concentration of power" that stifled opposition, where "dissent was frequently framed as a matter of national security." “The history of the TPLF resists simple verdicts,” Ewnetu concludes, urging #Ethiopia to pursue “a sober reckoning” with this complex legacy. https://addisstandard.com/?p=55264

Addis Standard

@addisstandardeng · Post #21694 · 12.03.2026 г., 14:55

Mulugeta Bekele: the jailed and tortured scientist who kept #Ethiopian#physics alive Mulugeta Bekele paid a heavy price for remaining in #Ethiopia in the 1970s and 1980s. While many other academics had fled their homeland to avoid being targeted by its military rulers, Mulugeta did not. He stayed to teach #physics, almost single-handedly keeping it alive in the country. But Mulugeta was arrested and brutally tortured by members of the #Derg, Ethiopia’s ruling military junta. “I still have scars,” he says when we meet at his tiny, second-floor office at Addis Ababa University (AAU) in January 2026. Gentle and softly spoken, Mulugeta, 79, is formally retired but still active as a research physicist. In 2012 his efforts led to him being awarded the Sakharov prize by the American Physical Society (APS) “for his tireless efforts in defence of human rights and freedom of expression and education.... https://physicsworld.com/a/mulugeta-bekele-the-jailed-and-tortured-scientist-who-kept-ethiopian-physics-alive/

Addis Standard

@addisstandardeng · Post #21131 · 20.01.2026 г., 09:54

#Book_Review: A Ten Minute Mission: The Least Price for Freedom by W. Hundee Hurrisoo In this book review, Ababiyaa Ahmed Ajmel examines W. Hundee Hurrisoo’s A Ten Minute Mission: The Least Price for Freedom, calling it more than a prison memoir—it exposes the “moral and political logic” behind the #Derg regime’s terror. As editor of Bariisaa, #Ethiopia’s first #Oromo-language newspaper, Hundee saw his symbol of “freedom’s light” targeted for erasure. Arrested under the false pretense of a “ten-minute mission,” he endured “4,040 days” in prisons like the Grand Palace and Maikalawi, where torture tools such as the “Stalin stick” broke bodies. The reviewer emphasizes that “the memoir is not only a record of erasure” but also affirms the Oromo concept of Jirra: “we are here, we exist”—a truth echoed by today’s #Qeerroo generation. https://addisstandard.com/?p=54635

Addis Standard

@addisstandardeng · Post #21511 · 24.02.2026 г., 10:33

#Commentary: From #Derg to #EPRDF to Present: #Ethiopia’s unfinished nation-state-building journey In this commentary, Merera Gudina traces Ethiopia’s persistent instability to failed state-building across the imperial, Derg, and EPRDF eras. He argues each collapse stemmed from rulers prioritizing personal power over the "equality of Ethiopian peoples" and their "thirst for development." Merera recounts how Emperor Haile Selassie’s 60-year reign ended ignominiously, even as hundreds of thousands perished in #Wollo, while the Derg, despite abolishing feudal landholding, succumbed to an "extreme lust for power," enforcing Stalinist "#Red_Terror" and destroying movements. The EPRDF era, meant to resolve the "nationalities question," became a 27-year "crude joke." Today, Ethiopia faces a "final frontier," requiring an end to "political theater" and "sham elections" for genuine unity. https://addisstandard.com/?p=55338