Что делать если нужно поставить какую-то 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
👍XBanking full update: fast unstake, security and the highest APR!
What is XBanking?
One of the largest DeFi pool aggregators (17,000+ pools, 46 networks, 150+ tokens), with increased interest rates for placing various tokens. The project has been audited and has a valid certificate from Certik🛡
🤩Advantages of the platform
We know that in crypto it is not only profitability that is important, but also mobility.#XBanking offers🔓fast unstake — you don't have to wait for the validation cycle to end, which can last up to 36 hours: withdrawal from staking is available at any time!
🪧Maximum profitability
For example, the APRin the liquidity pool is🤑$TON is 22%, and liquid staking tokens tsTON, stTON can be repledged at another 8%. There is no such yield on any of the TON platforms!
For comparison, TON staking APR:
💎 MyTonWallet — 3.91% Classic Staking
🪙 Tonkeeper — 3.89% Liquid Staking
🕊 StormTrade — 15.97% vault for DEX trading
📊Interest on TON tokens on
👍XBanking:
🤑$USDT— 32% APR
🐕🦺$DOGS — 28% APR
🐾$CATI — 18% APR
Higher APRs are usually associated with higher risks, so such instruments require a conscious approach, understanding of the mechanics and proper risk management.
🔥The platform has been updated — a cool, intuitive interface, everything is convenient and clear. Working with the platform has become even easier. There are even more opportunities ahead: farming in the TON network is coming very soon
👍Explore all liquidity pools
Website | Channel | Chat | X | Medium
👍One Token Instead of Two & No Impermanent Loss – how XBANKING is Redefining DeFi Standards?
Liquidity pools are one of the best ways to earn passive income in DeFi. However, the traditional model comes with two major drawbacks:
👎Traditional pools require two tokens to be deposited in equal proportions.
👎Impermanent Loss – losses caused by price fluctuations of one asset in the pool.
👍#XBANKING eliminates these barriers! 👍 Now you can deposit just one token and earn rewards on the full amount, while the system automatically balances the pools, mitigating impermanent loss.
📈How Does XBANKING Ensure High Returns?
• Trading fees – liquidity providers earn a share of commissions from #DEX using these pools.
• Automated pool management – smart allocation of liquidity optimizes returns.
• Farming & staking – additional rewards for participating in selected pools.
✅How Does XBANKING Reduce Risks?
• Algorithmic pool balancing – smart contracts automatically maintain liquidity ratios.
• Liquidity insurance fund – protects liquidity providers from unexpected losses.
• Smart contract audits – security is ensured through independent auditing firms.
#DeFi is evolving – only those who adapt and use the most effective tools stay ahead. Are you?
⚡️Unlock the Full Potential of DeFi
Website | Research | Guides | App | X
👍XBANKING has launched a referral program!
Here’s how it works:
👍 Earn 10% of the income generated by users you invite
👍 Commissions are based on the profit your referrals earn from liquidity pools
👍 Fully transparent: the higher the TVL of your referrals, the more you earn
Getting started is easy:
⚫️Create your personal referral link
⚫️ Share it — via social media, your blog, or communities
⚫️ Earn together with those who join through your link
🪙 Passive income isn’t always about capital — sometimes it’s simply about sharing the right tools.
#DeFi#XBANKING#Web3#Crypto
👍XBANKING celebrates 2 years – join in and earn bonuses!
❓ There are no magic "earn" buttons in crypto, but there are tools that, when approached wisely, allow you to generate passive income. Some of these tools offer higher rewards, but also come with higher risks. These require understanding. One such tool is liquidity pools.
Today’s spotlight is on #XBANKING, one of the largest DeFi liquidity aggregators (17000+ pools, 46 networks, 150+ tokens), now offering boosted APY for staking TON and other tokens:
💧 TON — 22% APY
💧 DUREV — 11% APY
💧 DOGS — 28% APY
💧 NOT — 14% APY
💵Why is this beneficial for holders?
By providing tokens to liquidity pools, you can earn higher yields than traditional staking. This strategy requires an understanding of how it works, but when approached strategically, it allows for efficient asset management while maintaining a relatively high level of security. The project has successfully passed security audit from #Certik🛡
⏱ These increased rates are available until the end of June 2025.
👍You can deposit $TON and other assets at mini-app:app.xbanking.org
Website | Channel | Chat | X | Help
#NFR#DYOR#DeFi#farming
USDE by
👍XBANKING — A Next-Generation Decentralized Stablecoin
XBANKING has launched USDE, a new stablecoin built specifically for DeFi, trading, and everyday payments. USDE blends stability, decentralization, and yield — offering 8% APR just for holding. Built on the
🤑 Solana blockchain.
💰USDE minting is now live ➡️app.xbanking.org
👍 1 USDE = 1 USD — always.
It’s backed 1:1 by liquid assets — USDT and USDC, with real-time reserves exceeding 101%.
🔎Why hold USDE?
✔️ Earn 8% APR simply by holding — the yield is built into the token.
✔️ No need to chase DeFi protocols or calculate risks — USDE starts earning immediately.
✔️ Use it like any other stablecoin: trade, add to liquidity pools, lend, or borrow.
✔️ 100%+ backed by USDT and USDC — no liquidation risks like with collateralized stablecoins.
✔️ Runs on Solana — fast, cheap, and user-friendly.
😀How does it work?
• Users deposit USDT or USDC into the XBANKING smart contract
• In return, they receive USDE at a 1:1 ratio
• The deposited stablecoins are allocated to DeFi strategies (liquidity pools, farming, etc.)
• The yield is distributed among all USDE holders
💼What you can do with USDE
✔️ Hold to earn 8% APR
✔️ Swap to USDT or USDC with zero fees
✔️ Trade on DEXs (available on Raydium)
✔️ Provide liquidity
✔️ Lend and borrow
🛡 What makes USDE stand out?
• Backed only by $USDT and $USDC
• Reserves exceed 100%
• 8% APR just for holding
• Minting and burning are controlled via smart contracts
• No liquidation mechanisms — unlike collateralized stablecoins
• Includes a token freeze function as an additional safeguard against phishing or exploits
📌Where to use USDE
— Mint: app.xbanking.org
— Smart contract: 8dt9fQhoRKuWCSAsYweG2UMF3rbcG9xzNCTWXXSmdmEi
— View on Solscan
— DEX: Raydium
USDE by XBANKING — a hybrid stablecoin designed for active DeFi use and long-term yield.
#USDE#Xbanking#Stablecoin#DeFi#Solana#Raydium#CryptoUX
Watch the video, like it 👍 and comment 💬 to get a prize!
🎞youtube.com/XBANKING
🎞youtube.com/XBANKING
🎞youtube.com/XBANKING
💵 The author of the best comment will get $10 from our channel!
Don't forget to subscribe to our YouTube channel!
#DeFi#Crypto#PassiveIncome#YieldFarming#LiquidityPools#Web3#XBANKING#CryptoInvesting