Что делать если нужно поставить какую-то 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
Arthur Hayes (@CryptoHayes) just unstaked and deposited 7.9M $ENA ($6.44M) to #Binance and #Bybit as the price dropped 9% in the past 24 hours.
He previously accumulated 16.79M $ENA at ~$0.666 ($11.19M) in late Nov 2024 and staked them for rewards.
To date, he has deposited 16.9M $ENA back to CEXs at ~$1.01 ($17M), likely earning $5.52M (+48%).
Follow @spotonchain and check out the #ArthurHayes entity via https://platform.spotonchain.ai/en/platform/entity/1552
🚨 Arthur Hayes just dumped nearly $5M in crypto!
Sold ETH, ENA, LDO, AAVE, UNI, and ETHFI in 24 hours. Looks like he's cashing out! 💸
#ArthurHayes#CryptoNews
🚀 Arthur Hayes: AI to Enhance Institutional Trading Dominance Over Retail Investors
Arthur Hayes has expressed that artificial intelligence will enable institutional trading systems to surpass retail traders in direct market competition. According to NS3.AI, Hayes advised retail investors to steer clear of short-term speculation and instead focus on holding cryptocurrencies for the long term.
#ArthurHayes#AI#InstitutionalTrading#RetailInvestors#Cryptocurrency#LongTermInvesting#NS3AI#MarketCompetition
🚀 Arthur Hayes Increases HYPE Holdings After Three-Month Hiatus
Arthur Hayes has made a significant move in the cryptocurrency market by purchasing 26,022 HYPE tokens, valued at approximately $1.1 million, after a nearly three-month break. According to BlockBeats, this acquisition brings his total holdings to 247,334 HYPE tokens, worth around $10.44 million, with an unrealized profit exceeding $2.5 million.
#ArthurHayes#HYPEHoldings#Cryptocurrency#CryptoMarket#BlockBeats#CryptoInvestment#HYPETokens#UnrealizedProfit
🚀 Arthur Hayes Skeptical of Iran's Alleged Bitcoin Toll Collection
Arthur Hayes expressed skepticism about Iran's purported acceptance of Bitcoin for toll payments on April 9. According to BlockBeats, Hayes stated that he would only believe Iran is collecting tolls in Bitcoin if he sees actual transactions on the Bitcoin blockchain. Otherwise, he considers it a tactic by the Islamic Revolutionary Guard Corps to mock the Western fiat currency financial system.
#ArthurHayes#Iran#Bitcoin#TollPayments#Blockchain#Cryptocurrency#IslamicRevolutionaryGuardCorps#FiatCurrency#FinancialSystem#BTC
Ethereum Rollback Proposed After Bybit Hack
Arthur Hayes proposes rolling back Ethereum to a block prior to the $1.5B Bybit hack, arguing it would benefit both the platform and holders. He asserts that Ethereum’s immutability can be revisited, citing prior instances. Support for the rollback comes from Bitcoin maximalist Samson Mow, suggesting it could limit funding for North Korea’s nuclear program. The plan involves pausing all ETH trading and renaming the hacked chain to ETHNK. Bybit CEO assures that company assets exceed the lost amount, with significant reserves remaining secure. For details, read more here.
#Ethereum#Bybit#Crypto#Blockchain#Security#Hack#SamsonMow#ArthurHayes#ETH#VC#LazarusGroup#NorthKorea#Defi#Investing#Market#Trading#USDT#WhaleAlert
🚀 Arthur Hayes Warns of Potential Federal Reserve Intervention in Private Credit Market
Arthur Hayes has highlighted concerns regarding the approximately $1.8 trillion private credit market, suggesting that stress within this sector could necessitate a liquidity intervention by the Federal Reserve. According to NS3.AI, Hayes noted that regulators are currently scrutinizing the exposure of banks and insurance companies as the sector faces rising redemptions and an increase in non-performing loans.
#ArthurHayes#FederalReserve#PrivateCredit#LiquidityCrisis#Banking#Finance#NonPerformingLoans#CreditMarket#Regulation
BTC & ETH ETFs See Massive Inflows
🎄Christmas Update on Crypto ETFs! BTC ETFs had an inflow of $978.6 million, while ETH ETFs attracted $128.7 million. Ex-BitMEX head Arthur Hayes predicts the bullish phase may peak by mid-March, suggesting to increase risk but take profits before April due to upcoming tax and liquidity tightening cycles. Positive dollar momentum is expected to boost liquidity by $612 billion. Key drivers include a decrease in RRP funds and TGA usage by the U.S. Treasury. 🚀
For more details, visit: Wu Blockchain News
#Crypto#BTC#ETH#ETF#ArthurHayes#MarketTrends#Liquidity#RRP#TGA#QuantitativeTightening#Finance#Investing#BullMarket#CryptoNews#MarketPredictions#Inflows#Christmas2025#LiquidityDrivers
Ethereum ETF Sees Major Inflows
The Ethereum spot ETF recorded a net inflow of $139M last week, with Blackrock's Ethereum ETF, ETHA, gaining $135M. However, on January 27, the crypto market saw declines across sectors, with DeFAI down 28.73%. Other sectors like AI Agents saw a 16.91% drop. U.S. crypto czar David Sacks noted ongoing evaluations regarding Bitcoin and digital assets. Meanwhile, Rosseti, Russia's state power company, plans to introduce Bitcoin mining to leverage idle power resources. Runetoshi's new memecoin, Runes, faced volatility, dropping from $28M to $500k in market value. Arthur Hayes predicts Bitcoin could dip to $70,000 before a future rise to $250,000 this year. More on ETF inflows | Market drop details | David Sacks comments | Rosseti's Bitcoin mining | Runes token collapse | Hayes Bitcoin predictions
#Ethereum#ETF#Crypto#Bitcoin#Russia#Mining#Securities#Stablecoins#PricePrediction#DigitalAssets#Memecoin#MarketDrop#Runetoshi#DeFi#AI#QuantitativeEasing#USDC#WhaleAlert#MarketVolatility#FinancialCrisis#ArthurHayes