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

Резултати

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

Пребарај: #uxuy

当前筛选 #uxuy清除筛选
Airdrop Center

@centralchanel · Post #16337 · 30.01.2025 г., 04:56

➡️ UXUY Wallet ✅ PLAY NOW: https://t.me/UXUYbot/app?startapp=A_452308012_inviteEarn Invested by BinanceLab 👈 Ends on January 10 ⛔️ $10.2M in funding successfully raised 🟢 1️⃣Securely store your private key 2️⃣Complete all tasks 3️⃣ Claim rewards every 3 hours 👍 UXUY: Don’t forget to back up your seed phrase! ❓ "Not your keys, not your crypto!" 👉 The Seed Phrase Backup Task is live! Complete the backup and claim your reward of 800 $UP! #UXUY

Hashtags

🪙UXUY Wallet: Mysterious Airdrop When? TOMORROW, March 11, the project on Binance Labs investments #UXUY Wallet launches distribution, but there is an important condition: ✅UXUY wallet in Telegram needs to be created today!🔥 What needs to be done? ✔️ Hurry up to create a wallet before March 11 00:00 UTC. ✔️ Tell your friends — let them get a drop too! ✔️Follow the news! ☝️Create UXUY wallet now!

Hashtags

UXLINK

@uxlink_community · Post #18 · 31.10.2024 г., 03:10

🥰Good morning fams! We are pleased to announce that UXLINK Mini App is live on LINE , now invite your friends on Line to join #UXLINK can get 10,000,000 #UXUY points reward! In UXLINK's "One Account, One Gas" roadmap, $UXLINK will be the universal gas token for users who interact with different blockchains, and LINE and Kakao Talk will be important pillars of social platforms, will keep build and keep our community updated.

Hashtags

Super Airdrop from UXUY Wallet #UXUY, incubated and supported by 🤑 Binance Labs, is launching the 2025 UXUY Points ($UP) #Airdrop! 🗓️ Dec 27, 2024 — Jan 10, 2025 How to join? Invite three or more friends using your unique referral link ✅Go to the UXUY Earn Center ✅ Click on Tasks ✅ Complete them to earn UXUY Points ($UP) 🎁Join the event now and earn 2,025 $UP per user!

🔠🔠2025 New Year Special Airdrop Event ends in just 2 days! 🔣 Users who successfully invite 3 friends during the event period (December 27, 2024 — January 10, 2025) will receive an exclusive bonus of 2,025 $UP! 🔠🔠 Don’t miss out — get in there and rack up more $UP before it’s over! #UXUY#wallet#airdrop

UXUY Wallet: Redefining Cross-Chain DeFi UXUY is a platform (wallet and DEX) that provides tools and solutions for DeFi, focusing on multi-chain transactions and interoperability. The main focus of the project is to facilitate the process of exchanging assets between different blockchains (cross-chain), with an emphasis on security, speed and convenience. The project raised $10.2M in a funding round from well-known funds such as Binance Lab, KuCoin Ventures, MEXC and others. Key features of UXUY: 1. Multi-chain compatibility: The platform supports interoperability between multiple blockchains, including Ethereum, BNB Chain, Polygon, Arbitrum, Avalanche and 🤑 TON. 2. Decentralization: Users retain full control over their assets as transactions are conducted directly through smart contracts, eliminating intermediaries. 3. Intuitive Interface: UXUY is focused on making DeFi easier for users, including a simplified asset exchange process. 4. Focus on Security: State-of-the-art security mechanisms, including multi-layered transaction verification architecture, are used to protect user funds. UXUY Wallet Token – $UP The $UP token is a key element of the UXUY ecosystem. It will be used to pay exchange fees, provide access to premium platform features, serve as collateral in staking programs, and will also become a tool for DAO governance. The reward program has allocated 100 million UP, which will be distributed among the most active UXUY Wallet users. 🎁Complete tasks in the mini-app #uxuy#dex#airdrop#binance

Airdrop Center

@centralchanel · Post #15668 · 27.12.2024 г., 17:27

#Reminder UXUY WALLET 💎A project followed and supported by #Binance laps. 👀It has received high investments and its infrastructure is solid. The listing will probably not be extended. It conflicts with the logic of Claim Every 3 Hours. Link:⤵️ JOIN NOW https://t.me/UXUYbot/app?startapp=A_452308012_inviteEarn ⛏#uxuy#wallet#binancelaps

Airdrop Center

@centralchanel · Post #15821 · 04.01.2025 г., 20:20

January Listing 🔥 ✅#Nodepay: 6 January ✅#MomoAi: 6 January ✅#Xterio: 8 January ✅#Sidekick : 8 January ✅ $Vertus :13 January ✅#Seed : 15 January ✅#Xcoin : 20 January ✅#Tapswap : 23 January ✅#Wcoin : 25 January ✅#CommunityGaming : 28 January Unofficial Listing ✅#PAWS ✅#UXUY ✅#Yuligo ✅#MemeWar ✅#DuckChain ✅#Celia Stay connected