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

Резултати

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

Пребарај: #ireland

当前筛选 #ireland清除筛选
POPULAR FRONT

@popularxfront · Post #6122 · 01.05.2026 г., 18:26

🇮🇪#Ireland: A 66-year-old man has been arrested and charged after a car bomb exploded outside a police station in Dunmurry, west Belfast, last Saturday. The perpetrator allegedly hijacked a delivery driver’s car and forced him to drive it to the location, where a gas cylinder had been placed inside and later detonated remotely. While some sources report he has been charged with attempted murder, others say he is also facing terrorism-related offences. Police believe the attack may be linked to the dissident republican group known as the New IRA. (via The Guardian, BBC & birminghammail)

Hashtags

POPULAR FRONT

@popularxfront · Post #6034 · 25.04.2026 г., 23:42

🇮🇪#Ireland: A suspected car bomb has exploded outside a police station in Dunmurry, Northern Ireland. Regional reports, including those from the Belfast Telegraph, state that the vehicle had been hijacked before being driven next to the police station, where it subsequently exploded. Police have cordoned off streets in the Kingsway area and are treating the situation as a “security incident.” No further details have been released at this time. (via Belfast Telegraph & @spicebag32; 📹 via @NiResponsevids on X)

Hashtags

POPULAR FRONT

@popularxfront · Post #5867 · 11.04.2026 г., 19:02

🇮🇪#Ireland: A man armed with a hammer breached security at Shannon Airport and climbed onto an American C-130 aircraft earlier today. Once on top of the plane, he attempted to damage it with the hammer. The man, who is in his 40s, was quickly arrested. No motive has been released, and his identity has not been disclosed.

Hashtags

POPULAR FRONT

@popularxfront · Post #5864 · 11.04.2026 г., 15:07

🇮🇪#Ireland: Up to 100 Gardaí were deployed to the Whitegate refinery, where protests have entered their fourth day amid rising fuel prices linked to the US and Israeli war against Iran. Footage shows Irish police forcibly attempting to remove trucks and tractors blocking the roads, with violent scenes breaking out. Officers can be seen kicking and stomping on farmers. Meanwhile, other videos appear to show protesters as young as 14 being pepper-sprayed by Gardaí.

Hashtags

POPULAR FRONT

@popularxfront · Post #5837 · 09.04.2026 г., 12:30

🇮🇪#Ireland: The Irish Army is set to be deployed across the country to remove heavy & agricultural vehicles blocking fuel depots, as protests over fuel prices enter their third day. Slow-moving convoys are targeting these sites over increasing fuel prices caused by the US and Israeli war against Iran. Police are now treating these actions as “blockades", with Gardaí (Irish police) reportedly requesting the assistance of the Irish army. In a statement, the Irish Minister for Justice said that once the army is deployed, people should not complain about any damage caused during the removal. (via CNN & limerickleader)

Hashtags

POPULAR FRONT

@popularxfront · Post #4697 · 24.01.2026 г., 11:11

🇮🇪#Ireland: ONH members fired a volley of shots in the Currynerin area of Derry last week. A 31-year-old man was arrested in connection with the event (though later released on bail) and a vehicle was seized. The PSNI have promised to increase ‘reassurance patrols as well as house-to-house enquiries and vehicle checkpoints in response. Repost via @spicebag32

Hashtags

POPULAR FRONT

@popularxfront · Post #4036 · 02.12.2025 г., 09:58

🇮🇪#Ireland: A new Irish militant group calling itself the "New Republican Movement" has announced its formation. In a video, where all members are armed, a masked man lists several motivations for creating the group, mostly focusing on mass immigration. They threaten Irish politicians with "immediate action", claiming to have their addresses. (via @real_eire on X)

Hashtags

Voyage.Travel.Tourism

@VOYAGE · Post #1298 · 10.02.2025 г., 13:14

📍Ireland’s architectural heritage – a journey back to the 19th century🇮🇪 📏 📏 📏 📏 📏 📏 📏 📏 🌟With its stunning castles, ancient ruins, and charming Victorian buildings, Ireland offers a glimpse into the past, where history and beauty come together in every stone. 📏 📏 📏 📏 📏 📏 📏 📏 #Ireland🇮🇪@voyage

Hashtags

Voyage.Travel.Tourism

@VOYAGE · Post #1200 · 19.12.2024 г., 13:14

📍Ireland’s architectural heritage – a journey back to the 19th century🇮🇪 📏 📏 📏 📏 📏 📏 📏 📏 🌟With its stunning castles, ancient ruins, and charming Victorian buildings, Ireland offers a glimpse into the past, where history and beauty come together in every stone. 📏 📏 📏 📏 📏 📏 📏 📏 #Ireland🇮🇪 @voyage

Hashtags

Voyage.Travel.Tourism

@VOYAGE · Post #761 · 17.02.2024 г., 13:04

Ireland, Rock of Cashel 🇮🇪 The Rock of Cashel is one of the most visited landmarks in Ireland, also known as St. Patrick's Rock. It is also referred to as the Rock of Kings. ⛰ 🏰 Located in the ancient Celtic cathedral in County Tipperary, Ireland. The castle, built in the 4th century, was the royal residence of the provinces of southern Ireland; after 100 years, St. Patrick settled there. After Cromwell's army attacked, the castle complex became a symbol of the resilience and courage of the Irish people. The castle grounds still preserve residential buildings, structures for agricultural purposes, and the ruins of the cathedral. #Ireland @voyage

Hashtags

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