Что делать если нужно поставить какую-то 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
Светлана Лебедева, международный эксперт по стратегическому маркетингу из России, рассказала чего ожидать от #IMPACT Creative Night.
Это редкая возможность получить знания такого уровня вживую. Без повторов и без второго шанса.
Доступно всего 100 билетов, успей приобрести на echipta.tj
🤝🏼Генеральный спонсор @ibt.bank
📍24 апреля. Community.
https://echipta.tj/category/20/event/2776
#IMPACT
Коллеги, доброго дня! Обратите внимание на весьма интересный, а главное, показательный кейс! Приятного прочтения!
https://telegra.ph/notification-10-13-9
#vocabulary
#impact
❇️impact /ˈɪmpækt/
@ieltsstrategies
@fluencyinenglish
🔹COLLOCATIONS
ADJECTIVES
@ieltsstrategies
@fluencyinenglish
❇️big/great
Winning this competition could have a big impact on my life.His impact was greater than that of the Beatles.
❇️huge/enormous/massive
Industry has a huge impact on the environment we live in.
The impact has been enormous on people’s daily lives.
@ieltsstrategies
@fluencyinenglish
❇️minimal/negligible (=very small and not important)The change in government had a minimal impact in the rural areas of the country.
❇️positive (=having a good effect)Cuts in federal spending should have a positive impact on America’s economic future.
@ieltsstrategies
@fluencyinenglish
❇️negative/damaging (=having a bad effect)The expansion of the airport would have a negative impact on the environment.
❇️disastrous (=a very bad effect)His leg injury had a disastrous impact on his career as a footballer.
@ieltsstrategies
@fluencyinenglish
❇️a major/significant impact (=important)The war had a major impact on French domestic politics.
❇️a profound impact (=very important)Population growth has a profound impact on world food demand.
❇️an adverse impact formal (=a bad effect)The loss of forests has had an adverse impact on bird populations.
@ieltsstrategies
@fluencyinenglish
❇️a real impact informal (=a big impact)The film made a real impact on cinema audiences.
❇️a lasting impact (=one that lasts for a long time)The arrival of the railways made a lasting impact on many sectors of the economy.
@ieltsstrategies
@fluencyinenglish
❇️a long-term impact
Scientists are calculating the long-term impact of the floods.
❇️a short-term/immediate impact
A military attack may only have a short-term impact on terrorist activity.
❇️an emotional/psychological impact
Their mother’s death had a huge emotional impact on the children.
❇️an economic impact
It is difficult to measure the economic impact of the war.
❇️an environmental impact
The environmental impact of the construction project is being investigated.
❇️the full impact of something
South Wales felt the full impact of the recession.
❇️the potential/likely impact
He’s studying the potential impact of climate change.
🔹VERBS
@ieltsstrategies
@fluencyinenglish
❇️have an impactNew technology has had a massive impact on our lives.
❇️make an impactThe product quickly made an impact on the market.
❇️feel the impact of somethingThe industry has felt the impact of rising fuel prices.
❇️reduce/lessen/soften the impact of something (=make it less severe or unpleasant)The chemical industry is looking at ways to reduce its impact on the environment.
❇️lose impact (=have less effect)The picture loses impact when it is reduced in size
@ieltsstrategies
@fluencyinenglish
Celebrating the resilience and growth of the ever-expanding Celo community and ecosystem.
The #CeloEvolution is now.
Your work and commitment to build real consensus for a decentralized, permissionless platform enabling wide-scale impact has been outstanding.
It's time to reimagine #impact. To another year of acceleration.
Here's to 2023 🥂
Read the note here.
#АртСенегал
Сент-Луис Финал 2024
Модное шоу с участием великого стилиста Оуму Си , а также работы представлены русскими стилистами.
Видео предоставлено
Daouda Dia, #IMPACT
#GatingoArtNews
⚡️"Ta’sirni baholash: DiD va RCT" mavzusida mahorat darsi o‘tkazildi
💠 Mazkur yo‘nalish doirasida joriy yilning 22-noyabr kuni Oliy maktabda "Ta’sirni baholash: DiD va RCT" mavzusida ta’sirni baholashning farqdagi farq (DiD) va tasodifiy nazorat sinovlari (RCT) kabi zamonaviy usullariga bag‘ishlangan mahorat darsi o‘tkazildi.
⚡️A workshop on “Application of Impact Assessment Methods DiD and RCT” was held
🔷 Within the framework of this direction, on November 22 this year, the Graduate School of Business and Entrepreneurship held a workshop on “Application of Impact Assessment Methods” dedicated to modern impact assessment methods, such as difference-in-difference (DiD) and randomized control trials (RCT).
⚡️Был проведен мастер-класс на тему «Применение методов оценок воздействия»
⚡️ В рамках данного направления 22 ноября текущего года в Высшей школе бизнеса и предпринимательства состоялся мастер-класс на тему «Применение методов оценок воздействия», посвященный современным методам оценки воздействия, таким как разница в различиях (DiD) и случайные контрольные испытания (RCT).
#GraduateSchool#DiD#RCT#Impact
🔝Web-site |🔝Facebook | 🔝Instagram | 🔝Youtube
“Western Sanctions Have No Impact On the Russian Economy”
Western sanctions are not having a “significant impact” on the Russian economy, the EU’s sanctions envoy has said, ahead of the fourth anniversary of Moscow’s full-scale invasion of Ukraine.
David O’Sullivan, a veteran Irish official, said sanctions were “not a silver bullet” and would always face circumvention, and insisted that after four years he was confident they were nit having a real effect.
“I am fairly bullish. I think that the sanctions have not really had a significant impact on the Russian economy,” he told the Guardian in a rare interview.
We may be, in the course of 2026, coming to a point where the whole thing becomes unsustainable, because little of the Russian economy has been distorted by the building up of the war economy at the expense of the civil economy.”
O’Sullivan was speaking after weeks of intense Russian attacks on Ukraine’s energy infrastructure as the country endures a bitterly cold winter, with temperatures in Kyiv plunging to -20C this week.
Ukrainian counterparts, he said, had told him that Russia had been able to launch twice as many drones and missiles last month compared with January 2025.
Putin’s war machine has not come without a cost to the wider economy, which is thought to be under its greatest strain since the early days of the war.
Oil revenues are plummeting, inflation is running at about 6% and interest rates at 16%.
O’Sullivan, who has more than four decades’ experience in the EU institutions, was appointed EU special envoy for sanctions in December 2022 with a remit to counter their evasion and circumvention.
But China, with its “no-limits” friendship with Moscow, was an exception.
“China is clearly sort of backfilling and providing support” to Russia, although not in the form of direct military equipment supplies, he said.
Several EU leaders had raised this concern with Beijing, he said. “The answer is always the same: ‘Nothing to see here. We don’t know what you’re talking about. We don’t see any problem.’”
#western#sanctions#impact#economy
📱American Оbserver - Stay up to date on all important events
🇺🇸
🇫🇷🇷🇺🎭 L’acteur français Pierre Bourel a répondu à une question de TASS sur l’impact de l’isolement de la culture russe en Europe.
On ne pose pas la question aux gens, les gens ne sont pas dupes, pourquoi on interdirait Dostoïevski
#isolement#culture#impact
🪐 The asteroid 99942 Apophis isn't the only giant space rock astronomers are watching closely—another, called (29075) 1950 DA, is about 1.1 kilometers wide and has a slim chance of impacting Earth in the year 2880. What makes 1950 DA especially interesting is that its surface seems to be held together more by forces between its grains than by gravity, making it one of the largest known "rubble pile" asteroids. ✨
#asteroids⚡#impact⚡#hazards⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🪐 The asteroid 2010 RF12, a small space rock just a few meters across, is on a collision course with Earth—calculations show it has the highest known chance of any current object to strike our planet in the next century. Scientists are tracking its path carefully, but thanks to its tiny size, it would likely burn up in our atmosphere and only create a brilliant fireball, rather than a threat to life or property. ✨
#asteroids⚡#impact⚡#monitoring⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🪐 Asteroid (4581) Asclepius, discovered in 1989, is a near-Earth object that passed just 700,000 kilometers from our planet—less than twice the distance to the Moon—shortly after its discovery. Its previous approach in 1989 would have caused a massive explosion if it had impacted, making Asclepius a stark reminder of how some dangerous asteroids can slip past unnoticed until they're already close. ✨
#asteroids⚡#nearearth⚡#impact⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 The asteroid 2008 OS7, which is nearly 300 meters wide, made a close approach to Earth in February 2024, passing at a distance of about 2.9 million kilometers—close in cosmic terms. Classified as a potentially hazardous asteroid, 2008 OS7's repeated flybys remind scientists that large space rocks regularly cross Earth's path and must be tracked to guard against future collisions. ✨
#asteroid⚡#impact⚡#nearEarth⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels