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

Пребарај: #concerts

当前筛选 #concerts清除筛选
Bali News

@balinews · Post #177 · 20.09.2024 г., 09:37

🎤Green Day and Maroon 5 will perform in Jakarta in February 🎸 Legendary American punk rock band Green Day is returning after 29 years with a concert in Jakarta. Billie Joe Armstrong and friends will perform at Carnaval Ancol on Saturday, February 15, 2025. The Green Day concert will be part of the 10th anniversary celebrations of Hammersonic, the largest metal - and rock music festival in Southeast Asia. 🎫Ticket sales have already started, and rock-loving Indonesians are sure to snatch up the best deals very quickly. 🎙 In addition, another very famous band, Maroon 5, will be coming to Jakarta in February. Their concert will be held a little earlier, on February 1 at the Jakarta International Stadium. The concert will be held as part of the band's Asian tour. 🎫Pre-sale of tickets opens on Tuesday, September 24 at 10:00. @BaliNews #wheretogo#concerts#events

Bali News

@balinews · Post #281 · 29.12.2024 г., 10:51

👋Morgenstern in Bali 📆 On January 11, Morgenstern, one of the most epathetic and discussed artists of our time, will perform at NUANU. His concerts are a colorful show that combines provocation, powerful energy and unforgettable atmosphere. Each performance of the artist is an explosion of emotions, unexpected decisions and drive. 🎫 Tickets to the dance parterre cost from IDR 1,333,333. 📍 NUANU concert venue official website. @BaliNews #wheretogo#holidays#concerts

America 🇺🇸 News & Politics

@America · Post #10510 · 17.04.2026 г., 13:08

💸🎵FEDERAL JURY RULES LIVE NATION TICKETMASTER ILLEGAL MONOPOLY 🔹 Manhattan jury finds companies overcharged consumers by 1.72 per ticket across 22 states 💰 🔹 Controls 70% of U.S. amphitheaters through exclusive venue deals, threatens competitors 🎪 🔹 Total damages estimated at 150 million — could be tripled under federal law ⚖️ 🔹 Fans spent 1.5 billion annually in Pennsylvania alone on overpriced tickets 🎫 🔹 Potential breakup: Live Nation forced to sell Ticketmaster division 💥 10-year merger finally faces justice — concert fans ripped off too long! 🎤 #USNews#monopoly#concerts @america

Bali News

@balinews · Post #386 · 08.04.2025 г., 12:35

🎸Singer and surfer Jack Johnson to give a concert in Bali 📆 Jack Johnson will be coming to Bali in 2025 for a chamber event to be held at Uluwatu Surf Villas on Bukit Peninsula on June 18, 2025 and it will be one performance only. 🎫 Less than 1,000 tickets are expected to go on sale. It costs Rp 2,205,000 for adults and Rp 815,000 for children 5-12 years old. Food and drinks will be available all evening and the event will be completely outdoors. It will be held in all weather conditions. ℹ️ The singer has become known for his soft acoustic music that has become a symbol of the surf culture of the 2000s (many have heard one of his most famous tracks Better Together. Jack Johnson rose to fame after the release of surf movie The September Sessions, where he performed his first songs. @BaliNews #events#concerts#Bukit

Bali News

@balinews · Post #238 · 16.11.2024 г., 12:11

🎸Linkin Park will perform in Jakarta in early 2025 🎤 Linkin Park, the iconic alternative rock band, has finally started touring again. In 2024, after finally recovering from the loss of Chester Bennington, the band has added vocalist Emily Arsmstrong to their lineup. 📍Jakarta is the only city in Southeast Asia that the legendary band will visit. 📆 The concert will take place on February 16, 2025, Indonesia will be the fourth country the band will visit since the beginning of the tour, right after Brazil, Saudi Arabia, Mexico and Japan. 🎫Tickets for the show will be available from November 18 on the official website. Which venue Linkin park will perform at is not yet known. Keep an eye on the information as the best tickets for such concerts are sold out very quickly. @BaliNews #events#concerts#wheretogo#Jakarta