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

Резултати

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

Пребарај: #staking

当前筛选 #staking清除筛选
TONlines – News

@tonlines · Post #6934 · 28.04.2025 г., 09:08

⚡️Gatto Official Channel: April $GTON Staking Rewards Announced #$GTON #staking Gatto Official Channel has completed the April $GTON staking. Participants have received various rewards including Duckzills and gattoboxes. Long-term token retention awards are also being given for the first time, with new staking starting May 1. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #7675 · 02.12.2025 г., 06:41

⚡️Hipo: Maximize Your Staking Rewards with TON and HPO #TON#staking Hipo offers one of the highest staking reward rates in the TON ecosystem, allowing users to earn both TON and HPO. The dual reward system enhances long-term value for HPO holders and strengthens Hipo’s TVL. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #7293 · 20.05.2025 г., 12:28

bemo | TON Staking Glossary for Beginners and Pros #staking#TON The bemo channel provides a comprehensive glossary on staking in TON, covering essential terms like slashing, LST, APY, and TVL. This resource is perfect for both newcomers and experienced users, with clear explanations and visual aids. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #6801 · 16.04.2025 г., 16:02

EVAA: Leveraged Staking Workshop Tomorrow #TON#staking Join the EVAA workshop tomorrow to learn about leveraged staking, tsTON liquid staking, and how to boost your TON and EVAA XP. The event, hosted by @thetonstakers, promises a beginner-friendly and fun format with real-time interaction. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #7173 · 12.05.2025 г., 13:46

Hipo: Understanding Staking in Crypto #crypto#staking Hipo explores the concept of staking in blockchain networks like TON and Ethereum. The video explains the process of earning rewards through staking, the role of staking pools, and how Hipo enhances security with liquid staking. Source: link @tonlines

🎙Huge potential Staking announcement 👉Investors, those who was interested in staking UpOnly has announced the launch of a new $UPO Staking Round on August 19th 🔥🔥 UpOnly will start a new staking round for $UPO holders on August 19th, at 12:00 UTC. Investors can stake for 30 days, 60 days, or 90 days, with differing returns between 15%-25% APR. Investors can start staking $UPO in the newly opened staking portal today. UpOnly has lowered the staking threshold to as little as 1 UPO. ⏰ 30 days, 60 days, or 90 days staking 🥇 Returns between 15%-25% APR Lets go💥 👉More info: uponlyofficial.substack.com/p/uponly-launches-new-upo-staking-round 👉 Website: https://www.uponly.com/ #staking#promotion

TONlines – News

@tonlines · Post #6843 · 18.04.2025 г., 16:54

Bemo: The Advantage of Liquid Staking #staking#DeFi Bemo introduces liquid staking with bmTON, allowing users to earn rewards while maintaining asset accessibility. This approach integrates seamlessly with TON DeFi and provides strategic benefits for active portfolio managers and yield farmers. Source: link @tonlines

TONlines – News

@tonlines · Post #7648 · 29.11.2025 г., 12:12

Gatto | Official Channel Staking Update for December #staking#GTON Gatto | Official Channel announces a staking event in December for $GTON token holders. Participants can earn various rewards, including exclusive prizes and in-game items, by holding tokens from December 1st to 29th. Source: link @tonlines

TONlines – News

@tonlines · Post #7647 · 29.11.2025 г., 12:12

Gatto: December Staking Rewards Begin December 1 #staking#GTON Gatto | Official Channel announces a new staking initiative for $GTON, starting on December 1 and running until December 29. Participants will be rewarded with various prizes, including game items and tokens, depending on their stake tier. Source: link @tonlines

TONlines – News

@tonlines · Post #7642 · 28.11.2025 г., 15:33

Gatto | Official Channel: November $GTON Staking Completion #staking#GTON The Gatto | Official Channel successfully concluded the November $GTON staking event. Participants maintained their tokens on game balances and earned rewards like gold coins and gattoboxes. The next staking begins on December 1st, with more information on rewards coming soon. Source: link @tonlines

TONlines – News

@tonlines · Post #7436 · 29.05.2025 г., 14:30

Gatto Official Channel: June Staking Rewards for $GTON #GTON#Staking The Gatto Official Channel announces June staking for $GTON, offering substantial rewards for maintaining the token on your game balance. The campaign runs from June 1 to June 30, featuring exclusive prizes not accessible through regular purchase. Source: link @tonlines

TONlines – News

@tonlines · Post #7000 · 01.05.2025 г., 08:01

⚡️Gatto Official Channel: Start of $GTON Staking #GTON#staking Gatto Official Channel announces the beginning of $GTON staking, with the first snapshot scheduled for today at 09:00 UTC. Players are encouraged to top up their game balance and hold $GTON until the end of staking on May 30 to receive rewards. Random balance cuts will occur daily, and details about rules and rewards can be accessed online. Source: link @tonlines

123•••67
ПретходнаСтраница 1 од 7Следна