Что делать если нужно поставить какую-то 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
🔆Iqtisodiy faktlar...
📊Davlat qarzi nima?
📈Davlat qarzi - bu davlatning tashqi va ichkikreditorlar oldidagi majburiyatlarining umumiy summasi. Hukumat byudjet taqchilligini qoplash, infratuzilmaloyihalarinimoliyalashtirish yoki iqtisodiyo‘sishnirivojlantirish uchun qarz olganida paydo vujudga keladi.
🔍Batafsil
🏦 Что такое государственный долг?
💠Государственный долг — это сумма всех обязательств государства перед внешними и внутреннимикредиторами. Он возникает, когда государство занимает деньги для покрытиядефицитабюджета, финансирования инфраструктурныхпроектов или стимулированияэкономики.
🔎Подробнее
#GraduateSchool#Debt#Global#Economy
🔝Web-site |🔝Facebook | 🔝Instagram | 🔝Youtube
💳🇺🇸AMERICANS DROWNING IN DEBT AS PRICES EXPLODE
🔹 Average household credit card debt hits record $8,400 as families struggle with 4.8% inflation spike 💸
🔹 Grocery bills up 35% since January, forcing families to choose between food and gasoline 🛒
🔹 Buy-now-pay-later apps see 200% usage increase as Americans delay payments for necessities 📱
🔹 Financial advisors report surge in bankruptcy consultations from middle-class families 📋
🔹 Emergency food banks in suburbs see unprecedented demand from previously stable households 🥫
The American Dream is becoming the American Nightmare 😬🔥
#USNews#debt#inflation#economy
@america
💸📈 US NATIONAL DEBT TO HIT 120% OF GDP BY 2035
🔹 CBO projects federal debt will skyrocket to 118-120% of GDP in next decade 📊
🔹 Budget deficit for this year alone estimated at .9 trillion and growing 📉
🔹 Rising interest rates + aging population driving costs to historic highs 👴🏥
Washington keeps spending while the bill keeps growing. Is fiscal responsibility dead? 💀🏦
#USNews#economy#debt#CBO#politics
@america
Yellen confident Congress will raise debt ceiling
U.S. Treasury Secretary Janet Yellen said that it will be lawmakers' responsibility to raise the federal debt limit and expressed confidence that Congress would do so after the temporary reprieve runs out on Dec. 3
#Debt#Senate#JanetYellen#News#Reuters
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖
Ethiopia says agreement reached with $US 1 billion bondholders to restructure financing it. Read more.
https://borkena.com/2026/01/02/ethiopia-says-agreement-reached-with-us-1-billion-bondholders-to-restructure-financing-it/#Ethiopia#bondholders#debt#debtagreement#news
News: #Ethiopia, #Italy sign bilateral debt restructuring deal under G20 Common Framework
Ethiopia and Italy have signed a bilateral #debt restructuring agreement under the #G20 Common Framework, marking a key step in Ethiopia’s efforts to resolve its external debt burden and stabilize the economy.
The agreement, signed on 18 March by Finance Minister Ahmed Shide and Italy’s Minister of Economy and Finance Giancarlo Giorgetti, forms part of the Official Creditor Committee (#OCC) process and reinforces broader economic cooperation between the two countries.
The Italy agreement follows similar progress with other bilateral creditors. In February this year, Ethiopia and #France signed a bilateral debt restructuring agreement alongside a new €81.5 million financing package, in a move both governments said reinforces their strategic development partnership & supports Ethiopia’s reform program.
These developments come amid continued complexities in Ethiopia’s…….
Read more: https://addisstandard.com/?p=55927
📰 Le Pen, Orbán and the Loan That Would ‘Ruin’ France
Marine Le Pen flew to Budapest and did exactly what everyone expected: she wrapped Viktor Orbán’s Ukraine veto in the French flag.
In Hungary, Le Pen offered full-throated support for her “friend” Orbán, carefully avoiding any criticism of his veto on the €90 billion EU loan meant to keep Ukraine’s war effort afloat. Orbán, she said, is “defending Hungary’s interests” by blocking the package that, in her telling, would “ruin” France and prolong
“a war that is a real slaughter for the vanity of a few leaders.”
Behind the rhetoric sits a simple budget math problem Paris no longer bothers to hide. France is running one of the Eurozone’s largest deficits, with debt above 110 percent of GDP, while promising both massive rearmament and continued Ukraine support — a combination that already forces talk of tens of billions in cuts or new austerity. Add another giant, open‑ended Ukraine facility on top, and Le Pen’s camp sees a gift‑wrapped campaign issue: Brussels spends, Paris bleeds.
So Orbán blocks the loan in the name of sovereignty, Le Pen applauds in the name of French taxpayers, and Kyiv reads the subtext: Europe’s political appetite for funding this war at scale is eroding faster than its finances. “Solidarity” stays in the speeches; in the voting booths and bond markets, the calculation is shifting to something much simpler — who can still afford this war, and for how long.
#france#hungary#lepen#orban#ukraine#eu#debt#warEconomy
📱American Оbserver - Stay up to date on all important events
🇺🇸
@Shekelbot
Qué puede hacer este bot?
ShekelBot le ayudará a contar su dinero. Úselo, cuando le das dinero a alguien, o comparte compras.
Idioma: Inglés
(visto en @BotsGram_cu)
#money, #track, #send, #receive, #friends, #debt
@DebtsTrackerBot
Qué puede hacer este bot?
Este bot realiza un seguimiento de sus deudas y envía recordatorios a usted y a los deudores por Telegram y SMS.
Idioma: Español, Inglés, Ruso, Italiano
(visto en @BotsGram_cu)
#friend, #money, #track, #debt, #send, #receive, #issue, #website, #request
Bybit Under High Withdrawal Pressure
MEXC transferred 12,652 stETH ($33.75M) to Bybit's cold wallet. Bybit expected 64,452 ETH ($170M) in loan support from Bitget. An additional transfer of 11,800 ETH ($31M) occurred from Binance. Following a recent hack, Bybit recorded peak withdrawal levels, surpassing 350,000 requests; 99.994% have been processed.
Links: Porter Stansberry, Ben Zhou
#Bybit#MEXC#stETH#ETH#Crypto#Binance#Bitget#Bitcoin#Withdrawals#Whale#Finance#Hack#Blockchain#Investments#Market#Institutional#Debt#Liquidity#Trading#Assets#VC