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

Резултати

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

Пребарај: #legislativeregionalelections2025

当前筛选 #legislativeregionalelections2025清除筛选
Venezuelanalysis

@venanalysis · Post #1983 · 25.05.2025 г., 20:54

🎥 "Let’s not leave spaces for those who once used the National Assembly to ask for sanctions to generate suffering and migration." ALBA-TCP Secretary General Jorge Arreaza from the Manuel Palacios Fajardo polling station in El Panal Commune. This is where Hugo Chávez voted. #LegislativeRegionalElections2025

Venezuelanalysis

@venanalysis · Post #1979 · 25.05.2025 г., 15:43

🗳️🇻🇪 ELECTIONS | Venezuela’s legislative and regional elections are underway. Electoral authorities report that 100% of voting station officials are present and 95% of polling booths were activated by 8:30 AM. Nearly 16,000 polling stations have been set up across the country. 📡 Follow Venezuelanalysis’ rolling blog for live coverage throughout the day: https://venezuelanalysis.com/news/venezuelas-2025-legislative-and-regional-elections-rolling-coverage/ #LegislativeRegionalElections2025

Venezuelanalysis

@venanalysis · Post #1978 · 25.05.2025 г., 14:26

📢 Venezuela heads to the polls today, May 25, to elect a new National Assembly, state governors, and regional legislative councils. The United Socialist Party (PSUV) and its allies in the Great Patriotic Pole selected candidates through a hybrid process: grassroots assemblies across the country and leadership evaluations, according to PSUV candidate Oliver Rivas. A total of 36 national parties, 10 regional ones, and 6 indigenous organizations are on the ballot. 🗳️ Follow Venezuelanalysis for rolling coverage throughout the day here: https://venezuelanalysis.com/news/venezuelas-2025-legislative-and-regional-elections-rolling-coverage/ #LegislativeRegionalElections2025

Venezuelanalysis

@venanalysis · Post #1975 · 23.05.2025 г., 10:23

🗳️🇻🇪 This Sunday, Venezuelans return to the ballot box to choose new regional lawmakers and local officials. Count on Venezuelanalysis for on-the-ground updates, context, and full election day coverage! 👉 In the meantime, check out our complete electoral guide here: https://shorturl.at/NylSl #LegislativeRegionalElections2025

Venezuelanalysis

@venanalysis · Post #1974 · 22.05.2025 г., 18:56

📘 GUIDE | Venezuela’s 2025 Legislative and Regional Elections: A Quick Guide 🗳️🇻🇪 Venezuelans head to the polls on Sunday, May 25, to elect a new National Assembly, governors in all 24 states, and members of regional legislative councils. This marks the 32nd electoral process under the Bolivarian Revolution. Our quick guide breaks down the key elements of the vote, including the electoral process, major parties and candidates, and key races to watch. 👉 Read the full guide here: https://venezuelanalysis.com/analysis/venezuelas-2025-legislative-and-regional-elections-a-quick-guide/ #LegislativeRegionalElections2025

Venezuelanalysis

@venanalysis · Post #1961 · 12.05.2025 г., 19:46

📰 NEWS | Venezuelan Electoral Authorities Run Election Exercise as Regional, Legislative Campaigns Enter Home Stretch Venezuela’s National Electoral Council (CNE) carried out a nationwide voting simulation on May 10 in preparation for the May 25 elections, where over 21 million people are eligible to elect 285 National Assembly deputies and 24 governors. CNE Vice President Carlos Quintero said the trial confirmed electoral readiness, with fewer than 2% of voting machines experiencing issues. Meanwhile, the opposition is split between those campaigning and others, led by María Corina Machado, calling for a boycott. 36 parties are on the ballot, 13 of them allied with the ruling PSUV. 🗞 Read the full report here: https://shorturl.at/NhJ9l #LegislativeRegionalElections2025

Venezuelanalysis

@venanalysis · Post #2025 · 08.07.2025 г., 21:03

🎥 VIDEO | Maduro-led Forces Sweep Elections While US Silent: Discussion With Eyewitnesses Venezuela held elections on May 25 that saw the pro-government Great Patriotic Pole secure overwhelming majorities both in the National Assembly and regional governorships. In response, the International Manifesto Group convened a panel of international analysts to assess the electoral process, Venezuela’s internal political dynamics, and the broader geopolitical implications. 👉 Watch the full video here: https://venezuelanalysis.com/video/maduro-led-forces-sweep-elections-while-us-silent-discussion-with-eyewitnesses/ #LegislativeRegionalElections2025#NicolasMaduro

Venezuelanalysis

@venanalysis · Post #1992 · 30.05.2025 г., 19:02

📝 INTERVIEW | Venezuela’s Participatory Democracy and the Struggle Against Imperialism: A Conversation with Alison Bodine In the latest VA interview, international observer and activist Alison Bodine shares her reflections on Venezuela’s May 25 elections. She highlights the country’s participatory democracy, where political engagement goes far beyond the ballot box. Bodine also critiques the role of mainstream media and calls for coordinated international solidarity to confront US and Canadian sanctions. “Seeing the Bolivarian Revolution in action has profoundly shaped my political views,” she states. 🔗 Read the full interview here: https://venezuelanalysis.com/interviews/venezuelas-participatory-democracy-and-the-struggle-against-imperialism-a-conversation-with-alison-bodine/ #LegislativeRegionalElections2025#Sanctions#Solidarity

Venezuelanalysis

@venanalysis · Post #1971 · 21.05.2025 г., 16:24

📰NEWS | Venezuelan Government Denounces ‘Terrorist’ Plot to Sabotage May 25 Elections Venezuelan authorities have detained 38 individuals—21 Venezuelans and 17 foreigners—accused of involvement in an alleged far-right conspiracy to sabotage the May 25 regional and legislative elections. Targets reportedly included embassies, hospitals, police stations, and public infrastructure. According to Interior Minister Diosdado Cabello, the detainees included mercenaries and explosives experts who entered Venezuela via Colombia, posing as tourists. In response, flights from Colombia have been suspended until May 26 at 6:00 p.m. 🔗 Read the full article here: https://shorturl.at/UZMnJ #LegislativeRegionalElections2025#Terrorism

12
ПретходнаСтраница 1 од 2Следна