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

Резултати

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

Пребарај: #staxxx

当前筛选 #staxxx清除筛选
CaptKyle Patriots Ⓡ 🍊

@CaptKylePatriots · Post #284636 · 03.05.2026 г., 20:16

🔠 🔠 🔠 Keychains can be found HERE 🔠 🔠 🔠 3D Printed Custom Night Lights (you send your image and I'll make it happen) Offering custom 3D print services. Just message me for anything you may need (@teamanons1) 🔠 🔠 🔠 - 10g Year of the Snake Bill Shaped Bars 🐍 🔠 🔠 🔠- Premium Copper on website 1oz Colorized Patriotic Bars 1oz Silver Cards (different styles) Back in stock 1g Team Anon Bars 👉 (@pmkllc) Introducing 🔠🔠🔠 🔤🔤🔤🔤🔤🔤🔤 on the website here 👇 https://precious-metal-trump-notes.myshopify.com/collections/pmk-raffles?utm_campaign=share_orders&utm_content=android&utm_medium=product-links Just click SHOP ALL on website to view ALL available products. Check out all the items featured on Capt Kyle's Telegram 👇 https://preciousmetalkeepsakes.com/collections/capt-kyles-featured-products Also. If you have a bigger budget and want some heavy metal. Please just message me (@teamanons1) or text me directly (number lower on post) prices are way lower for bigger budget! I offer a WIDE variety of different types of Precious Metals from 1 gram to kilos (kilos are not on website only @pmkllc) always sigma tested and verified genuine .999 fs/fg or your money back! GUARNTEED! Www.preciousmetalkeepsakes.com Just click 🔤🔤🔤🔤🔤🔤🔤here For any questions or concerns call or text anytime (502-252-1039) I'll be glad to help in anyway or message me here on telegram 📱 (@teamanons1) I always have 👇 ✅10oz bars of silver ✅5oz bars of silver ✅1oz Copper rounds. Several designs to choose from ✅Lots of other Precious Metal items available ⏰ 🟥 ⏰ 🟥 ⏰ 🟥 ⏰ 🟥 ⏰ 🟥 Www.preciousmetalkeepsakes.com 🟥 ⏰ 🟥 ⏰ 🟥 ⏰ 🟥 ⏰ 🟥 ⏰ ➡️I have BETTER Prices and items not on website here @pmkllc To follow new arrivals/Giveaways RAFFLES and everything Precious Metals Join our telegram page here (@pmkllc) 😇 🥰 🥰 🥰 🥰 🥰 🥰 🥰 😇 ➡️Go to @pmkllc if your interested in having a chance of winning precious metals for a fraction of the price ➡️RAFFLES I met Capt Kyle at the beginning of my Awakening journey and he has been nice enough to allow me to share my website on his channel and has never asked for anything in return. I greatly appreciate you Capt Kyle 🙏 Www.preciousmetalkeepsakes.com #silver#preciousmetals#ta#staxxx 🦅🇺🇸💪🔥

CaptKyle Patriots Ⓡ 🍊

@CaptKylePatriots · Post #284332 · 26.04.2026 г., 20:24

🔠 🔠 🔠 Keychains can be found HERE 🔠 🔠 🔠 3D Printed Custom Night Lights (you send your image and I'll make it happen) Offering custom 3D print services. Just message me for anything you may need (@teamanons1) 🔠 🔠 🔠 - 10g Year of the Snake Bill Shaped Bars 🐍 🔠 🔠 🔠- Premium Copper on website 1oz Colorized Patriotic Bars 1oz Silver Cards (different styles) Back in stock 1g Team Anon Bars 👉 (@pmkllc) Introducing 🔠🔠🔠 🔤🔤🔤🔤🔤🔤🔤 on the website here 👇 https://precious-metal-trump-notes.myshopify.com/collections/pmk-raffles?utm_campaign=share_orders&utm_content=android&utm_medium=product-links Just click SHOP ALL on website to view ALL available products. Check out all the items featured on Capt Kyle's Telegram 👇 https://preciousmetalkeepsakes.com/collections/capt-kyles-featured-products Also. If you have a bigger budget and want some heavy metal. Please just message me (@teamanons1) or text me directly (number lower on post) prices are way lower for bigger budget! I offer a WIDE variety of different types of Precious Metals from 1 gram to kilos (kilos are not on website only @pmkllc) always sigma tested and verified genuine .999 fs/fg or your money back! GUARNTEED! Www.preciousmetalkeepsakes.com Just click 🔤🔤🔤🔤🔤🔤🔤here For any questions or concerns call or text anytime (502-252-1039) I'll be glad to help in anyway or message me here on telegram 📱 (@teamanons1) I always have 👇 ✅10oz bars of silver ✅5oz bars of silver ✅1oz Copper rounds. Several designs to choose from ✅Lots of other Precious Metal items available ⏰ 🟥 ⏰ 🟥 ⏰ 🟥 ⏰ 🟥 ⏰ 🟥 Www.preciousmetalkeepsakes.com 🟥 ⏰ 🟥 ⏰ 🟥 ⏰ 🟥 ⏰ 🟥 ⏰ ➡️I have BETTER Prices and items not on website here @pmkllc To follow new arrivals/Giveaways RAFFLES and everything Precious Metals Join our telegram page here (@pmkllc) 😇 🥰 🥰 🥰 🥰 🥰 🥰 🥰 😇 ➡️Go to @pmkllc if your interested in having a chance of winning precious metals for a fraction of the price ➡️RAFFLES I met Capt Kyle at the beginning of my Awakening journey and he has been nice enough to allow me to share my website on his channel and has never asked for anything in return. I greatly appreciate you Capt Kyle 🙏 Www.preciousmetalkeepsakes.com #silver#preciousmetals#ta#staxxx 🦅🇺🇸💪🔥

CaptKyle Patriots Ⓡ 🍊

@CaptKylePatriots · Post #283643 · 11.04.2026 г., 22:29

🔠 🔠 🔠 Keychains can be found HERE 🔠 🔠 🔠 3D Printed Custom Night Lights (you send your image and I'll make it happen) Offering custom 3D print services. Just message me for anything you may need (@teamanons1) 🔠 🔠 🔠 - 10g Year of the Snake Bill Shaped Bars 🐍 🔠 🔠 🔠- Premium Copper on website 1oz Colorized Patriotic Bars 1oz Silver Cards (different styles) Back in stock 1g Team Anon Bars 👉 (@pmkllc) Introducing 🔠🔠🔠 🔤🔤🔤🔤🔤🔤🔤 on the website here 👇 https://precious-metal-trump-notes.myshopify.com/collections/pmk-raffles?utm_campaign=share_orders&utm_content=android&utm_medium=product-links Just click SHOP ALL on website to view ALL available products. Check out all the items featured on Capt Kyle's Telegram 👇 https://preciousmetalkeepsakes.com/collections/capt-kyles-featured-products Also. If you have a bigger budget and want some heavy metal. Please just message me (@teamanons1) or text me directly (number lower on post) prices are way lower for bigger budget! I offer a WIDE variety of different types of Precious Metals from 1 gram to kilos (kilos are not on website only @pmkllc) always sigma tested and verified genuine .999 fs/fg or your money back! GUARNTEED! Www.preciousmetalkeepsakes.com Just click 🔤🔤🔤🔤🔤🔤🔤here For any questions or concerns call or text anytime (502-252-1039) I'll be glad to help in anyway or message me here on telegram 📱 (@teamanons1) I always have 👇 ✅10oz bars of silver ✅5oz bars of silver ✅1oz Copper rounds. Several designs to choose from ✅Lots of other Precious Metal items available ⏰ 🟥 ⏰ 🟥 ⏰ 🟥 ⏰ 🟥 ⏰ 🟥 Www.preciousmetalkeepsakes.com 🟥 ⏰ 🟥 ⏰ 🟥 ⏰ 🟥 ⏰ 🟥 ⏰ ➡️I have BETTER Prices and items not on website here @pmkllc To follow new arrivals/Giveaways RAFFLES and everything Precious Metals Join our telegram page here (@pmkllc) 😇 🥰 🥰 🥰 🥰 🥰 🥰 🥰 😇 ➡️Go to @pmkllc if your interested in having a chance of winning precious metals for a fraction of the price ➡️RAFFLES I met Capt Kyle at the beginning of my Awakening journey and he has been nice enough to allow me to share my website on his channel and has never asked for anything in return. I greatly appreciate you Capt Kyle 🙏 Www.preciousmetalkeepsakes.com #silver#preciousmetals#ta#staxxx 🦅🇺🇸💪🔥