Что делать если нужно поставить какую-то 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
Lookonchain | ꘜ
The #EthereumFoundation-linked wallet(0xF39d) sold another 1,300 $ETH($5.87M) at $4,518 ~11 hours ago.
Over the past 3 days, this wallet has sold a total of 6,194 $ETH($28.36M) at an average price of $4,578.
https://x.com/lookonchain/status/1955432926776267254
Lookonchain | ꘜ
The #EthereumFoundation-linked wallet(0xF39d) sold another 1,100 $ETH($5.06M) at $4,602 ~25 minutes ago.
https://x.com/lookonchain/status/1955425305826562053
Lookonchain | ꘜ
A wallet (0xF39d) linked to the #EthereumFoundation sold 1,695 $ETH for 7.72M $DAI at $4,556 in the past 2 hours.
This wallet originally received 20,756 $ETH ($95.5M now) from the #EthereumFoundation wallet " EF 1" back in 2017.
https://etherscan.io/address/0xf39d30fa570db7940e5b3a3e42694665a1449e4b
The #EthereumFoundation has sold the remaining 1,250 $ETH($2.8M).
So far, all 5,000 $ETH planned for sale have been fully converted into 11.11M $DAI, at an average price of $2,221.
https://x.com/lookonchain/status/2042049034622476548
An #EthereumFoundation-related wallet transferred 92,500 $ETH($294.9M) to a new wallet 9 hours ago after being dormant for 6.6 years.
Through on-chain tracking, it was found that these $ETH were received from the #EthereumFoundation on Sept 1, 2015.
https://etherscan.io/address/0x0dbd8de20eed94a5693d57998827fcf68ed2ecf4
A wallet linked to the #EthereumFoundation sold 4,095 $ETH for 18.75M $DAI at $4,578 per token in the past 4 hours.
This same wallet received 20,756 $ETH (then worth $4.75M) from the Ethereum Foundation in May 2017.
Follow @spotonchain for more updates now!
https://x.com/spotonchain/status/1955450754975911978
[ATTENTION] The Ethereum Foundation sold 100 $ETH for 307,893 $DAI again after just 7 days!
So far, 300 $ETH has been sold for $981.2K at an average price of $3,271 in the first 27 days of 2025.
The $ETH price dropped by 7.33% today!
Follow @spotonchain and set alerts for the #EthereumFoundation's next moves at https://platform.spotonchain.ai/en/entity/125
🚨🚨 BREAKING: The Ethereum Foundation deposited 35,000 $ETH ($93.8M) to #Kraken an hour ago!
This is their largest $ETH transfer out in 2024 so far. Previously, the Ethereum Foundation had only occasionally sold a few hundred $ETH on DEX, totaling 2,516 $ETH for 7.4M $DAI.
Follow @spotonchain for more updates about the #EthereumFoundation now via https://platform.spotonchain.ai/en/platform/entity/125
🚀 Ethereum Foundation Completes Sale of 5,000 ETH
The Ethereum Foundation has successfully sold 5,000 ETH, according to Foresight News. The sale resulted in 11.1 million DAI, with an average selling price of $2,221 per ETH.
#EthereumFoundation#ETH#sale#DAI#cryptocurrency#ForesightNews
🚀 Ethereum Foundation Sells $8.3 Million in ETH to Support Initiatives
The Ethereum Foundation has completed the sale of approximately $8.3 million worth of ETH. According to NS3.AI, this move aligns with the foundation's earlier announcement to sell a total of 5,000 ETH. The proceeds from this sale are intended to support ongoing research, development, and grant initiatives within the Ethereum ecosystem.
#EthereumFoundation#ETH#NS3AI#Ethereum#Cryptocurrency#Blockchain#Research#Development#GrantInitiatives
SEC Chair Gensler Resigns; Bitcoin Surges
🇺🇸 SEC Chair Gary Gensler has officially resigned, causing ripples in the market.
Bitcoin fluctuates around $103,000 to $104,000.
Additionally, Solana’s Total Value Locked (TVL) exceeds $10B for the first time since the FTX collapse. 🔥 In other news, the Ethereum Foundation has established a multisig wallet, transferring 50,000 ETH for DeFi participation.
Recent whale transfers:
- 21,631 #WSOL ($5.39M) burned at an unknown wallet.
- 1.62M #TRUMP ($67.39M) transferred between wallets.
- 214,834 #SOL ($52.81M) also transferred between wallets.
More on Ethereum’s new wallet
Solana's TVL increase
Whale Alert for TRUMP transfer
Whale Alert for SOL transfer
#Crypto#Bitcoin#SEC#Ethereum#SOL#DeFi#TRUMP#WhaleAlert#FTX#Finance#Market#FinanceNews#EthereumFoundation#TVL#Blockchain#Altcoins#Regulations#CryptoNews#Investments
Steve Yun Speaks at Consensus HK
On February 20, Steve Yun from TON Foundation will present at Consensus HK, discussing 'Emerging Markets on the Road to Financial Freedom.' Join to explore DeFi's future and the impact of evolving regulations on Web3. Details here.
⚡️ OpenSea announces OS2 beta version and airdrop. Read more
🚓 In Thailand, Russians arrested for stealing Bitcoin worth $16.5 million. Read more
🧠 A look into the Metaverse and AR/VR projects you might have missed. Read more
🐋 VanEck says some US states will buy $23.5 billion in Bitcoin. Read more
👀 A new Bitcoin-ETF linked structured bond launches in Russia. Read more
🧐 JPMorgan identifies condition for Tether's compliance with US regulations. Read more
❌ Illegal Bitcoin farm shut down near Irkutsk. Read more
🤖 Sam Altman discusses features of GPT-4.5 and GPT-5. Read more
💫 BNB recovered losses following 2025 roadmap release. Read more
🔎 Ethereum Foundation allocates $120 million to DeFi protocols. Read more
👾 WLFI co-founder's X-account hacked to promote a scam. Read more
🔥 Former Greek finance minister criticizes Bitcoin maximalists. Read more
#Finance#DeFi#Web3#Bitcoin#OpenSea#Crypto#Ethereum#EthereumFoundation#Cryptocurrency#Blockchain#Thailand#Regulation#CryptoNews#SamAltman#AI#Innovation#Technology#Investment#Metaverse#ARVR#VanEck