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

Пребарај: #raffle

当前筛选 #raffle清除筛选

1️⃣2️⃣3️⃣4️⃣5️⃣ 🤑The long-awaited distribution has begun $NOT from DropHunter! Total will be distributed💎 1'000'000 $NOT, the total pool is $20'000, and there are only 1000 prize places, the team estimates that by the end of #AirDrop the reward amount will be >$30 per winner. There are currently 2 types of prize giveaways: 1️⃣AirDrop Raffle — “who plays more, gets more” The terms of participation: ➡️ Apply for participation in Raffle through a gaming bot ➡️ Buy tickets for coins (from 1 to 10 tickets) ➡️ Carrying out simple tasks ➡️ We are waiting for completion and results (from 1 to 5 days) 2️⃣Airdrop Rush — “The early bird gets the worm” FCFS. It all depends on your speed, because... the distribution will stop if all tokens have been distributed. The terms of participation: ➡️Apply to Rush ➡️ Complete simple tasks ➡️ Exchange coins for tickets as quickly as possible. Coin allocation is limited Now there is a promotion in#Raffle format, therefore: ✅Let's go to the bot ✅ We invite 3 friends ✅ We carry out a simple task with a subscription to the channel ✅ We buy tickets from 1 to 10 pieces for the game balance (10 pieces will increase your chances of winning by 10 times) ⚡️The promotion will last only 3 days! Very tasty distribution 👍 Considering that the project distributes this amount in the first month after launch. Game | Channel | Chat | Nexus Wallet

TONlines – News

@tonlines · Post #7608 · 25.11.2025 г., 07:41

Gatto | Official Channel: Legendary Crocottery Results Announced #raffle#prizes The Gatto | Official Channel has announced the winners of the Legendary Crocottery raffle. Luck has determined the prize recipients, who will receive their rewards within a week. Participants can check the results by finding their id in the linked table. Source: link @tonlines

TONlines – News

@tonlines · Post #7421 · 28.05.2025 г., 16:07

⚡️Gatto Official Channel: Exciting Prizes for Doge Pound Owners #raffle#DogePound Gatto Official Channel announces the results of a raffle for Doge Pound pet owners with exciting prizes. The raffle includes various sets of enormous bottles of essences and a set of cake slices for legendary pets. Two more drawings are scheduled for May 29 and 30 for participants owning at least one Doge Pound pet. Source: link @tonlines

⚖️Partnering upwith ThirdFi for making the space fairer and more rewarding! Mint TON Score and get x2 data points🪂 ❓How does it work? 1. Visit data.thirdfi.org 2. Mint your ThirdFi ID 3. Mint or Verify your Nomis TON Score⚖️ 🎁Plus ThirdFi gives away $100 USDT to 10 lucky winners who: 1. Follow @thirdfiorg & @0xNomis 2. Join @thirdfi_org & @nomis_protocol 3. Retweet Twitter Announcement 📆Join the campaign before September 4th, and seize onchain reputation benefits! LFG🚀 #NFT#mint#Nomis#ThirdFi#raffle#telegram#reward#onchain

🪙TON Treasure Hunter's Checklist Well, my little ones,🌟didn’t have time to follow ecosystem news? We have prepared for you another checklist with a selection of the most current #airdrop and events on TON. Current and new ⚡️Boost Event 🔥Our tribe in Blum 🔥Get referrals in SettleTON 🔥BroBot and TON Society 🔥Presale STORM 🔥Premarket CATI 🔥Staking DAOLama 🔥 DOGS listing coming soon 🔥Notcoin pools 🔥Season 5 of the TON Open League Popular mine sites 💰Mine TAPS from TapSwap 💰Mine BLUM from Binance lab 💰Mine HOT from HOT Wallet 💰Mine CUBES from TON Punks 💰Mine SWITCH in PocketFi 💰Mine CATI from Catizen 💰Mine FNZ from FanzeeBattle Gaining popularity 💰Mine THC from TON Hedge 💰Mine HOLD from Fintopio 💰Mine TRMNL from Terminal 💰Mine BNK from Architec.ton 💰Mine DROP from DropHunter 💰Mine GRAM from Gramilla 💰Mine points on Snapster 💰Mine points in Nomis TON 💰Mine WAT while driving a car And don’t forget to take a break from your smartphone...🫰 #TON#drop#web3#minning#raffle#NFT#Toncoin#notcoin#tapswap#hamster#pepe#meme#crypto