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

Резултати

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

Пребарај: #communardunion

当前筛选 #communardunion清除筛选
Venezuelanalysis

@venanalysis · Post #2018 · 01.07.2025 г., 20:24

📝 INTERVIEW | Juan Lenzo: ‘We Need to Integrate the Communal Economy to Face the Capitalist Maelstrom’ Juan Lenzo, a Venezuelan activist, takes stock of the Communard Union’s current strengths and challenges, with a particular focus on consolidating the communal economy. Today, 117 communes are part of the Union. To strengthen economic planning, the organization is mapping grassroots productive activity and identifying opportunities to rebuild the communal economy after years of crisis. One of its flagship efforts is the “Patria Grande del Sur” project in Bolívar state: a 187,000-hectare initiative developed with Brazil’s MST and local campesino communities. The goal is to build a communal agroecological system in phases, from infrastructure to production and education. “We’re not trying to strengthen the old state, we’re building a communal one,” he said. 🔗 Read the full interview here: https://shorturl.at/wejdV #CommunardUnion#Communes

Venezuelanalysis

@venanalysis · Post #1468 · 05.02.2024 г., 16:58

The Communard Union has deployed its “Argelia Laya Brigade” across the country in a bid to strengthen the organization and links between popular power collectives. Beginning on February 4, the activists are divided into "exploratory" and "permanent" brigades, with the former spending two weeks in specific territories and the latter committing to a six-month presence in priority areas as identified by the Communard Union. Their primary objective is to assess political, social, and economic conditions within the visited communes, aiming to formulate work plans that enhance organizational structures and integrate them into the Communard Union. Click here to see the gallery 👉🏽https://venezuelanalysis.com/images/venezuela-communard-union-launches-territorial-brigades/ #Venezuela#CommunardUnion#Communes

Venezuelanalysis

@venanalysis · Post #1587 · 29.05.2024 г., 22:11

🎙 Episode 25 of the Venezuelanalysis Podcast is now available! Venezuela’s revolutionary leader Hugo Chávez defined the commune as the “unit cell” for the construction of socialism. But the road ahead is full of challenges, even more so in a context of imperialist sanctions. In this episode, host José Luis Granados Ceja is joined by fellow VA member Cira Pascual Marquina and by Communard Union communications coordinator Juan Lenzo to discuss the present struggle to strengthen the communal economy and uphold the socialist horizon. Click here to listen to the full episode 👉🏼https://shorturl.at/gf26s #communardunion#communes#vapodcast

Venezuelanalysis

@venanalysis · Post #1935 · 12.04.2025 г., 00:29

📝 INTERVIEW | Communal Feminism in Venezuela: A Conversation with Moira Blanco Cardona The “communal feminism” project emerged from the experiences of women building popular power at the local level. “Communal feminism is the legacy of women who carried gas cylinders, distributed food, and recovered ancestral knowledge,” states Moira Blanco Cardona of the Communard Union. 🔗 Read more in the latest VA interview here: https://venezuelanalysis.com/interviews/communal-feminism-in-venezuela-a-conversation-with-moira-blanco-cardona #CommunalFeminism#CommunardUnion

Venezuelanalysis

@venanalysis · Post #1922 · 31.03.2025 г., 15:31

📸 IN IMAGES | Venezuela: 1,600 Women Discuss ‘Communal Feminism’ at First National Gathering On March 29, more than 1,600 women took part in the Communard Union’s first national gathering on communal feminism in Caracas. The meeting set four key priorities: developing a feminist economy, strengthening healthcare, eliminating gender-based violence, and expanding political participation. A commission was appointed to oversee these initiatives, with annual follow-up meetings planned. 🔗 Don’t miss the full gallery here 👉🏼https://venezuelanalysis.com/images/venezuela-1600-women-discuss-communal-feminism-at-first-national-gathering/ #CommunardUnion#Communes#Feminism

Venezuelanalysis

@venanalysis · Post #2138 · 13.10.2025 г., 19:25

📸 IN IMAGES | Venezuela: Communards Gather to Make ‘Communal Feminism’ a Priority From October 4 to 6, dozens of women representing around 20 communes gathered in Miranda state for a communal feminism meeting organized by the Communard Union and the Ministry of Communes’ School for the Strengthening of Popular Power (EFPP). The gathering addressed the collectivization of care work, feminist economy, political participation, and the prevention of gender-based violence. Organizers agreed to replicate the experience across different regions. 🔗 Don’t miss the full gallery here 👉🏼https://shorturl.at/s4WUS #CommunalFeminism#CommunardUnion#Communes

Venezuelanalysis

@venanalysis · Post #2083 · 01.09.2025 г., 18:13

📰 NEWS | Venezuela: Popular Organizations Push Direct Distribution Routes to Boost Food Security Pueblo a Pueblo and the Communard Union are providing affordable access to fish and vegetables by connecting popular organizations. Pueblo a Pueblo delivered 1,000 packs of fish and seafood, each weighing 3.8 kilograms, in Caracas, Yaracuy, Lara and Trujillo. The packages, sold at $13, represented savings of 50–60% compared to local markets. At the same time, the Communard Union transported 3.5 tons of vegetables from Trujillo to communes in Lara state. Between 500 and 600 people purchased potatoes, carrots, onions and tomatoes at prices around 40% below market levels. Both initiatives strengthen direct distribution routes between producers and communities. 🔗 Read the full report: https://shorturl.at/3HDgP #CommunardUnion#FoodSovereignty#PopularPower#PuebloaPueblo