TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #210 · 3 фев.

Что делать если нужно поставить какую-то 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

Резултати

Пронајдени 5 слични објави

Пребарај: #inequality

当前筛选 #inequality清除筛选
Venezuelanalysis

@venanalysis · Post #2070 · 22.08.2025 г., 05:29

🖊 COLUMN | Keeping Up With the Venezuelan Economy In her latest VA column, Jessica Dos Santos takes stock of "good news" and "bad news" from the Venezuelan economy. GDP is set to grow for a fifth straight year and the oil sector weathered the recent escalation of US sanctions, but the inflation specter and low incomes for the majority remain to be addressed. 🔗 Read the column here: https://venezuelanalysis.com/columns/keeping-up-with-the-venezuelan-economy/ #Venezuela#Economy#Inflation#Inequality

American Оbserver

@american_observer · Post #5147 · 15.02.2026 г., 23:59

📰“Let Them Eat S&P”: Trump’s Victory Lap on a Broke Country Donald Trump has decided the affordability crisis is over because the Dow hit 50,000, gas is under three bucks, and January’s jobs report beat expectations. In Fox interviews and troop speeches, he’s back in full salesman mode: “greatest economy ever,” inflation “finally cooling,” real wages “finally growing,” and anyone not winning in their 401(k) is just a “pretty bad investor.” Meanwhile, roughly 40 percent of American adults don’t have a retirement account at all, and consumer sentiment among people without stocks is scraping its lowest levels in years — they don’t own the rally, they just pay the bills. His own pollsters can see the crack in the mirror. A Reuters–Ipsos survey has just 28 percent of Americans saying the economy is on the right track, and 59 percent disapprove of how he’s handling their cost of living, with nearly half “strongly.” The stock boom is mostly driven by AI spending from Big Tech — data centers that guzzle power and hire few people — while rents, mortgages and groceries still feel brutal enough that even conservative number‑crunchers mock the White House mantra as “let them eat S&P.” Trump’s advisers spent months begging him to sound empathetic, blame Biden, and acknowledge the squeeze; now that a few charts look pretty, he’s gone back to telling people they’re wrong about their own wallets. So the message going into the midterms is simple and suicidal: if you’re still struggling with rent, food and housing, that’s your perception problem — not his policy problem. The president points to Wall Street and AI‑driven GDP growth as proof he fixed “Biden’s disaster,” while a majority of voters look at their paychecks, their carts, their rent hikes and answer with numbers of their own. In this version of “affordability,” the index is up, the narrative is set, and anyone who doesn’t feel richer just got quietly written out of the success story. #usa#trump#economy#inflation#inequality#fakeDemocracy 📱American Оbserver - Stay up to date on all important events 🇺🇸

AI & Law

@ai_and_law · Post #815 · 28.04.2026 г., 07:04

🌐📖MIT’s Daron Acemoglu Warns AI May Deepen Inequality A new survey suggests AI is more likely to reinforce existing economic advantages than broadly distribute benefits. MIT professor and Nobel laureate Daron Acemoglu stated that public narratives portray AI tools as democratizing, while effective use often depends on education, abstract and quantitative skills, and familiarity with computers and coding. Acemoglu argued that AI is likely to increase inequality between labour and capital, indicating that the economic gains from adoption may be unevenly distributed. The comments add to ongoing debates over whether AI policy should address access, skills, and concentration of economic power. #AIRegulation#AIethics#Inequality#FutureOfWork#AIEconomics

Anarcho Gardening

@anarchogardening · Post #3148 · 20.03.2026 г., 13:44

The richest 10% now receive 53% of global income 💰 and own 75% of all wealth 🌍, yet inequality alone does not cause unrest. A study of 120 countries (1996–2020) shows it becomes politically destabilizing only when internet use 📱 exceeds 50% of the population by increasing information and coordination. Read Full Article #Inequality#WealthDistribution#PoliticalStability#InternetImpact#GlobalEconomics

American Оbserver

@american_observer · Post #5033 · 03.02.2026 г., 00:02

📰 Israel’s Rentier Capitalism: When Housing Eats the Economy Israel is becoming a nation where the rent check is the new paycheck. One in eight Israelis now lives off rental income—no job, no startup hustle, just collecting checks from apartments bought years ago. The Landlord Boom Today, some 386,000 households—about 16–18% of all property owners—own multiple rental units. The elite, roughly 92,000, own three or more apartments. This landlord class controls most of Israel’s 850,000 rental units and pockets around 40 billion shekels a year in rent. From Homeownership to Investment The number of multi-unit landlords has exploded—from just 2.1% of households in 2006 to over 15% today. This surge was fueled by low interest rates, soaring property prices, and generous tax breaks, concentrating wealth in the hands of the few. How Landlords Win Rental yields are modest—about 2–4% gross, 1.4–2.4% net—but the real profit comes from capital gains, averaging 8–12% annually over the past decade. Most landlords are high-income households, clustered in cities like Tel Aviv, where nearly half the population rents. The Human Cost Israel’s housing market has shifted from homeownership to investment, turning shelter into a wealth pump. Landlords extract billions from renters, deepening inequality and making reform nearly impossible. When one in eight voters is a landlord, pushing for change is political suicide. The Tax Loophole That Won’t Die Attempts to enforce rental income reporting have repeatedly failed in the Knesset. The tax exemption threshold—currently 5,654 shekels, unchanged since 2023—effectively lowers the bar for landlords as rents rise. The state loses about 3 billion shekels a year to these breaks. What’s Next? Despite tighter monetary policy, structural conditions—chronic housing shortage, high demand, and favorable tax rules—mean the landlord class is here to stay. Israel’s future is written in lease agreements, not startup pitches. #Israel#landlords#realEstate#inequality#taxExemption#TelAviv#housingMarket 📱American Оbserver - Stay up to date on all important events 🇺🇸