Что делать если нужно поставить какую-то 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
PERFECT RING FORMED OVER LOS ANGELES
This appeared high above L.A. just after dusk.
A bright linear trail stretched across the sky — and around it, a smooth circular arc expanded and held its shape.
The symmetry is what stands out.
A straight line through the center.
A clean curve wrapping around it.
It lingered long enough for people across the city to stop and stare.
Los Angeles, California.
Did you catch this from where you are?
MrMBB333
👇 Drop your city.
#MrMBB333#SkyWatch#LosAngeles
https://x.com/mrmbb333/status/2053139040468418953?s=52
WHILE PEOPLE WERE SLEEPING… EARTH’S FREQUENCY WENT FULL WHITE-OUT AGAIN
Overnight, the Schumann Resonance exploded into repeated white-out bursts for more than 5 hours straight.
Not one quick spike.
Not normal background activity.
The chart kept surging, fading, then surging again — staying highly energized deep into the night while most people were asleep.
And the amount of white showing across the chart is hard to ignore.
Something kept the signal highly charged for hours.
Did anyone wake up suddenly last night?
• Vivid dreams
• Pressure or headaches
• Ringing ears
• Restless sleep
• Electronics acting strange
• Pets acting off
What are you noticing where you are?
#MrMBB333#SchumannResonance#SpaceWeather
https://i.fixupx.com/i/status/2045928133946433932
UNKNOWN ACTIVITY SHOWING UP AGAIN IN EARTH’S FREQUENCY
For nearly 7 hours, the Schumann Resonance monitor showed sustained saturation across multiple bands.
The signal didn’t clear.
It stayed compressed across the chart.
This isn’t a normal pattern.
It follows right behind the last disturbance.
Back-to-back activity now.
Something is passing through the system.
Origin unclear.
Monitoring.
#MrMBB333#SchumannResonance#SpaceWeather
https://x.com/i/status/2044454771378294895
300,000-MILE “GASH” IN THE SUN NOW FACING EARTH
Now directly Earth-facing.
A coronal hole over 300,000 miles wide is sending high-speed solar wind toward Earth.
• Fast solar wind already exiting
• Direct alignment in place
• Arrival ~36 hours
These setups can escalate geomagnetic conditions quickly — and sometimes hold them there.
👇
Watch for: auroras, magnetic disturbances, possible system interference.
#MrMBB333#SpaceWeather#SolarWind
https://x.com/mrmbb333/status/2054322376264057323?s=52
MASSIVE HOLE JUST OPENED IN THE SUN’S ATMOSPHERE
A powerful solar eruption has blasted a massive opening through the Sun’s outer atmosphere after an M5.7 flare triggered radio blackout conditions and launched a CME into space.
At the same time:
• radio blackouts were detected
• aurora chances increased
• satellites are being monitored closely
• solar activity continues intensifying again
What has many watching closely is how active the Sun has suddenly become again over the last several months — with multiple eruptions now firing from different regions almost simultaneously.
The Sun does not appear to be calming down.
Anyone noticing strange skies, signal issues, pressure, vivid dreams, ringing ears, or electronics acting strange lately?
#MrMBB333#SpaceWeather#CME
https://x.com/mrmbb333/status/2053541044068012078?s=52
SOMETHING KEPT HITTING EARTH’S FREQUENCY TODAY ⚡️
The Schumann Resonance has been showing something difficult to ignore.
The graph has been cycling through repeated bursts of intense activity, including multiple sustained whiteout periods and powerful 50 Hz pulses lasting close to an hour at a time.
This wasn’t a quick spike and fade.
The signal kept returning over and over with very little quiet in between.
At several points the chart looked completely overwhelmed before briefly calming… only to surge right back again.
The level of prolonged saturation showing up today has been unusual.
Anyone else feeling like today has felt unusually heavy, restless, intense, or just “off”?
Drop your location below.
#MrMBB333#SchumannResonance#EarthWatch#SpaceWeather
https://x.com/mrmbb333/status/2052868548574560425?s=52
🛸 THE UFO DISCLOSURE ISN’T THE BIGGEST STORY
Something changed.
Not just in Washington…
but in the skies.
For years people were mocked for talking about strange objects, unexplained lights, military encounters, electrical disturbances, and things that didn’t make sense.
Now suddenly…
files are being released.
Pilots are speaking openly.
Major media outlets are covering it nonstop.
But here’s what stands out
Why is all of this happening at the SAME time the world is seeing:
• increased solar activity
• strange sky phenomena
• drone/satellite concerns
• auroras farther south
• extreme weather worldwide
• nonstop reports coming from the skies
Maybe this was never just about UFOs.
Maybe something bigger is changing around us…
and people are finally starting to notice.
👇
What do YOU think is really going on right now?
#MrMBB333#UFO#Disclosure#SpaceWeather#UAP
https://x.com/mrmbb333/status/2053544993852379307?s=52
THIS WAS THE MOMENT THE SUN ERUPTED
New footage captured the exact moment Active Region 4436 unleashed a powerful M5.7 solar flare and blasted a huge CME into space.
The eruption came from the same unstable region now rotating across the Earth-facing side of the Sun and scientists are watching closely to see whether part of the plasma cloud is Earth-directed.
This clip shows just how violent and fast the eruption actually was.
More activity from this region remains possible.
#MrMBB333#SolarFlare#SolarStorm#CME#SpaceWeather