Что делать если нужно поставить какую-то 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
US Treasury yields surge to new highs as liquidity tightens, pushing
Make CryptoSlate preferred on
Bitcoin’s latest retreat below $80,000 shows how quickly the bond market has reclaimed control of crypto trading, even after lawmakers advanced one of the industry’s most closely watched regulatory bills.
Data from CryptoSlate showed that the top asset was trading at $79,083 as of press time, down…
#CryptoMining
─┅━━━━━⊰✵⊱━━━━━┅─
│📣 : @bovinebear │
│🤖 : @bovinebear_bot│
─┅━━━━━⊰✵⊱━━━━━┅─
Trump family trust bought Coinbase and these crypto-related stocks in
Make CryptoSlate preferred on
US President Donald Trump’s family trust executed hundreds of millions of dollars in financial transactions during the first quarter of 2026, including the acquisition of stocks directly tied to the digital asset industry, even as his administration pushed sweeping, pro-cryptocurrency regulatory overhauls.
According to a mandatory 278-T financial disclosure form…
#CryptoMining
─┅━━━━━⊰✵⊱━━━━━┅─
│📣 : @bovinebear │
│🤖 : @bovinebear_bot│
─┅━━━━━⊰✵⊱━━━━━┅─
Bitcoin rips as CLARITY Act clears major Senate Committee hurdle,
Make CryptoSlate preferred on
Bitcoin surged back above $81,000 after the Senate Banking Committee voted to advance the Digital Asset Market CLARITY Act, clearing a major hurdle for the most comprehensive crypto regulation bill in US history.
On May 14, the panel approved the legislation on bipartisan lines, sending the legislation to the…
#CryptoMining
─┅━━━━━⊰✵⊱━━━━━┅─
│📣 : @bovinebear │
│🤖 : @bovinebear_bot│
─┅━━━━━⊰✵⊱━━━━━┅─
Ripple insider warns XRP holders as fake airdrop scams surge across
Make CryptoSlate preferred on
The XRP Ledger (XRPL) is seeing a drastic rise in fraud attempts targeting its users as the network draws more institutional activity, higher transaction volumes, and renewed attention from XRP traders.
On May 14, David Schwartz, the former chief technology officer at Ripple, published a public warning regarding the increasing…
#CryptoMining
─┅━━━━━⊰✵⊱━━━━━┅─
│📣 : @bovinebear │
│🤖 : @bovinebear_bot│
─┅━━━━━⊰✵⊱━━━━━┅─
Bitcoin keeps rallying mid-month – Is Saylor using Strategy’s STRC
Make CryptoSlate preferred on
Bitcoin has been seeing recurring mid-month strength this year, and it is becoming harder to separate it from Strategy’s (formerly MicroStrategy) expanding preferred-stock machine. The funding channel is helping the company continue to buy the flagship digital asset while adding a growing layer of cost to its balance sheet.…
#CryptoMining
─┅━━━━━⊰✵⊱━━━━━┅─
│📣 : @bovinebear │
│🤖 : @bovinebear_bot│
─┅━━━━━⊰✵⊱━━━━━┅─
Global financial crisis fears grow as bond yields hit 1998 levels and
Make CryptoSlate preferred on
Is a global 2008-style economic crash nigh? And do current conditions resemble the early stages of a broader global financial crisis driven by debt costs, inflation pressure, and constrained policy responses?
Those questions have become harder to dismiss because the pressure points are stacking in the wrong order: high sovereign…
#CryptoMining
─┅━━━━━⊰✵⊱━━━━━┅─
│📣 : @bovinebear │
│🤖 : @bovinebear_bot│
─┅━━━━━⊰✵⊱━━━━━┅─
Trump’s CEO-filled China visit can decide whether Bitcoin’s $80,000
Make CryptoSlate preferred on
Bitcoin is hovering just below $80,000 as President Donald Trump arrives in Beijing for a high-stakes meeting with Chinese leader Xi Jinping, turning the visit into a live test of whether the crypto market’s latest risk rally has enough support to survive a difficult macro week.
The trip comes…
#CryptoMining
─┅━━━━━⊰✵⊱━━━━━┅─
│📣 : @bovinebear │
│🤖 : @bovinebear_bot│
─┅━━━━━⊰✵⊱━━━━━┅─
Trump’s CEO-filled China visit can decide whether Bitcoin’s $80,000
Make CryptoSlate preferred on
Bitcoin is hovering just below $80,000 as President Donald Trump arrives in Beijing for a high-stakes meeting with Chinese leader Xi Jinping, turning the visit into a live test of whether the crypto market’s latest risk rally has enough support to survive a difficult macro week.
The trip comes…
#CryptoMining
─┅━━━━━⊰✵⊱━━━━━┅─
│📣 : @bovinebear │
│🤖 : @bovinebear_bot│
─┅━━━━━⊰✵⊱━━━━━┅─
Bitcoin holders can now hide more of their activity, but only by
Make CryptoSlate preferred on
Starknet launched strkBTC on May 12, locking BTC on Bitcoin‘s base layer to back an ERC-20 token that brings shielded balances into a smart contract environment at scale.
The token runs in the public mode, where it behaves like any other wrapped Bitcoin asset, and shielded mode, where…
#CryptoMining
─┅━━━━━⊰✵⊱━━━━━┅─
│📣 : @bovinebear │
│🤖 : @bovinebear_bot│
─┅━━━━━⊰✵⊱━━━━━┅─
Hormuz oil contagion spreads to 8 major economies and Bitcoin has just
Make CryptoSlate preferred on
Bitcoin‘s path through 2026 now runs through global economic policy.
The disruption around the Strait of Hormuz has moved beyond a commodity-price event and into the machinery of governments.
The International energy Agency said crude and refined-product exports through the strait had fallen to less than 10%…
#CryptoMining
─┅━━━━━⊰✵⊱━━━━━┅─
│📣 : @bovinebear │
│🤖 : @bovinebear_bot│
─┅━━━━━⊰✵⊱━━━━━┅─
Circle adds $3 billion Wall Street Arc token risking an uncomfortable
Make CryptoSlate preferred on
Circle’s $222 million ARC token presale has given Wall Street a new way to value the USDC issuer, while raising a harder question for one of crypto’s most profitable alliances.
On May 11, Circle said investors led by a16z Crypto backed the presale of ARC, the native token for Arc,…
#CryptoMining
─┅━━━━━⊰✵⊱━━━━━┅─
│📣 : @bovinebear │
│🤖 : @bovinebear_bot│
─┅━━━━━⊰✵⊱━━━━━┅─
Washington insider warns US defeat in Iran now “likely”
Make CryptoSlate preferred on
A prominent figure from the Washington foreign-policy establishment has said openly what markets have been pricing in fragments: the United States has likely suffered a strategic defeat in Iran, and the failure runs through the Strait of Hormuz. Accepting this premise would introduce a new macro risk for…
#CryptoMining
─┅━━━━━⊰✵⊱━━━━━┅─
│📣 : @bovinebear │
│🤖 : @bovinebear_bot│
─┅━━━━━⊰✵⊱━━━━━┅─