Что делать если нужно поставить какую-то 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 terminologiya
📈Fiskal siyosat — bu davlat tomonidan iqtisodiyotni boshqarish uchun davlat xarajatlari va soliq stavkalarini tartibga solish choralaridir.
🏢 Фискальная политика — это совокупность мер, принимаемые государством для регулирования расходов и налогов с целью управления экономикой.
#GraduateSchool#FiscalPolicy#Economy
🔝Web-site |🔝Facebook | 🔝Instagram | 🔝Youtube
📈US Defense Budget and Geopolitical Underpriced Risk
Washington's inability to price the Iran war costs amid a $1.5 trillion military budget push is creating significant fiscal uncertainty for bond and equity markets.
🔗Read Full Analysis
🎯 SPECIAL OFFER: 15% OFF
💸 Coupon Code: salenow15%
🚀 Upgrade to premium signals → https://markets.fxpremiere.com/en/signals?utm_source=telegram
📰 Stay ahead — get breaking financial news & analysis at https://markets.fxpremiere.com/en?utm_source=telegram
#DefenseSpending#FiscalPolicy#TreasuryYields
🚀 U.S. Government Budget Deficit Narrows in March
The U.S. government reported a budget deficit of $164 billion in March. According to Jin10, this figure was slightly higher than the anticipated deficit of $156.7 billion but showed a significant improvement from the previous month's deficit of $308 billion. The narrowing of the deficit indicates a positive shift in the government's fiscal position compared to earlier projections.
#USGovernment#BudgetDeficit#FiscalPolicy#Economy#March2026#GovernmentFinance#EconomicUpdate
🚀 Commodities to Outshine Stocks Amid Geopolitical and Economic Turmoil, Says Bank of America Strategist
Bank of America strategist Michael Hartnett has indicated that investors should pivot towards the commodities market in the coming years, as this asset class is poised to benefit from global geopolitical and macroeconomic instability. According to Jin10, the ongoing Middle East conflicts and the race in artificial intelligence have heightened concerns over supply chains. Governments worldwide are striving to curb the soaring prices of energy and other natural resources, which impact industries and consumers, while also ensuring the supply of critical minerals like rare earths, essential for manufacturing and technology.
Hartnett suggests that for the remainder of this decade, commodities will replace stocks as the primary choice for investors seeking to hedge against risks, inflation, and a weakening dollar. This shift is expected as investors move away from equities in favor of commodities, which are anticipated to become the biggest winners in the "buy anything but bonds" trade. The strategist also notes that excessive fiscal expansion could lead to more frequent bear market rallies in government bonds rather than sustained bull markets.
#Commodities#Stocks#Geopolitics#Macroeconomics#Investment#Inflation#Energy#RareEarths#SupplyChain#AI#FiscalPolicy#MarketTrends
🚀 U.S. March Budget Deficit Estimated at $163 Billion
The U.S. Congressional Budget Office (CBO) has announced that the budget deficit for March is projected to reach $163 billion. According to BlockBeats, this estimate reflects ongoing fiscal challenges faced by the United States. The CBO's report highlights the financial pressures impacting the federal budget, as expenditures continue to outpace revenues. This development underscores the importance of addressing the nation's fiscal policies to manage the growing deficit effectively.
#USBudget#BudgetDeficit#FiscalPolicy#CBO#USFinance#FederalBudget#Economy#MarchDeficit#FinancialReport#USGovernment
Best & Worst Crypto Narratives Revealed
In the last month, AI Agents topped the charts with a 67.02% return, while CEX coins gained 42.61%. On the downside, Modularity fell by 30.99%, Memecoins dropped 28.41%, and LRT decreased by 27.74%. Read more here. ✨ Additionally, Hong Kong lawmakers are considering including Bitcoin in fiscal reserves, aiming to stimulate the crypto industry and boost tax revenue. More details can be found here.
#AI#Crypto#CEX#Bitcoin#Investment#FiscalPolicy#CryptocurrencyIndustry#HongKong#Finance#TaxRevenue#MarketAnalysis#Returns#LawPolicy#AIAgents#Modularity#Memecoins#CryptoTrends#Innovation#Funds#TalentAttraction
#The_Critic🇬🇧📕[PDF]⬇️
#November2025
#Monthly_Magazines
For learning, for free(dom).
@backupofmagazines
This issue dissects Britain’s political fatigue in “Follow the Leader,” charting how #Conservatives lost moral and cultural authority. Essays probe #FiscalPolicy fictions, #CultureWar fatigue, and the right’s need for artistic renewal. Features span #Trump diplomacy, Britain’s agricultural crisis, and a nostalgic defense of #Seapower. In culture, Cézanne’s southern light meets reflections on music, literature, and satire. Critics debate #Opera, #Theatre, #Books, and fine whisky—mixing wit with worry. It’s a portrait of a nation in ideological hangover. #UKPolitics#Brexit#Art#Society#ConservativeCollapse#TheCritic#Philosophy