Что делать если нужно поставить какую-то 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
#Update
Claim Your $CRTR Now
If you’re eligible, you can claim your $CRTR right now.
Act fast.
Link : fandora.ai/claim
Sc (BSC) :
0xb150e91Cb40909F47d45115eE9E90667D807464B
#Update
Pacifica Perp War Competition (Original Article)
There's a Perp War competition going on in Pacifica
You can choose one of the two teams to participate, and the winning team will receive a total of 500,000 points. So, Pacifica users, let's definitely register to participate!
- Total prize pool: 500,000 points
- Duration: ~ March 4th
- Teams: Bulls / Bears (choose one)
- Participation eligibility: Anyone
- Scoring method: (Trading volume ranking + PnL ranking) ÷ 2
* Only trading activities from after registration will be recognized, so please register on the Event tab first 🤲
Go directly to Pacifica
#Update
This week, 150 SafePal x Morpho co-branded X1 hardware wallets will be drawn from users who deposited ≥100 USDT
Meanwhile
• Top 50 depositors get the limited-edition wallet directly
• Depositors with ≥1,000 USDT will share $5,000 in $MORPHO
Huge congrats to all the winners!
#Update on BTC/USDT Analysis-
According to the analysis, after falling more than 30% in just one week, BTC has found support precisely at 49,000.
There are five psychological probabilities following this significant drop:
1. BTC could make a V-shaped recovery from this price level.
2. BTC could consolidate for more than 2-3 weeks before breaking out or breaking down.
3. BTC could break down below 49,000 and resume its downtrend.
4. BTC could initially break down, giving a false signal, and then rise.
5. BTC could consolidate for 2-3 weeks, then give a false breakout or breakdown and move in the opposite direction of breakout or breakdown.
📱│Remini v3.7.1305.202520468 (Pro)
⚙│ Android: 7.0 and up #update
🔔
🅿️ │ Play Store / Official Site Link
━━━━━━━━━━━━━━━━━━━
☑ | Features & Mod Info⭐
◉ Powerful Photo enhancer app in World
◉ Enhance blurry, pixelated photos to HD
◉ Auto recognize > enhance facial details
◉ Unblur photo and make photo clearer
◉ Repair old, blurry, scratched photos
◉ Enhance background and colors
◉ Pro Features Unlocked, No Ads
◉ Multi Languages & CPUs: Arm32/64
⚠️ Video Enhance feature is server-side
✍️ | Release by Mixroot
━━━━━━━━━━━━━━━━━━━
📥Link : CLICK HERE TO DOWNLOAD
━━━━━━━━━━━━━━━━━━━
▶️Tutorial : How To Download Mod
━━━━━━━━━━━━━━━━━━━
🔄Official Channel ➜ @Mixrootmods
📱│Picsart v29.7.7 (Gold / Premium)
⚙ │ Android: 6.0 and up #update
🔔
🅿️ │ Play Store / Official Site Link
━━━━━━━━━━━━━━━━━━━
☑ | Features & Mod Info
✅
◉ The best all-in-one photo & video editor
◉ beautify / drawing tools and more!
◉ No professional experience needed!
◉ Gold / Premium Membership Unlocked
◉ Al Avatar not works as it's server-sided
◉ Sign-in No Required / Bypassed
◉ Multi Languages & CPUs: Arm32/64
⚠️Ai features require login
✍️ | Release by Mixroot
━━━━━━━━━━━━━━━━━━━
📥Link : CLICK HERE TO DOWNLOAD
━━━━━━━━━━━━━━━━━━━
▶️Tutorial : How To Download Mod
━━━━━━━━━━━━━━━━━━━
🔄Official Channel ➜ @Mixrootmods
📱│ SnapTube v7.57.0.75750310 (VIP)
⚙│ Android: 5.0 and up #update
🔔
🅿️ │ Play Store / Official Site Link
━━━━━━━━━━━━━━━━━━━
☑ | Features & Mod Info⭐
◉ Ability to download from many sites
◉ IG, Fb post downloader, Status Saver
◉ Download in multiple resolutions
◉ Download any video as an MP3 file
◉ Explore videos in Ur favorite categories
◉ Pause, Cancel or resume downloads
◉ VIP features unlocked / No ads
◉ Multi Languages & CPUs: Arm32/64
➡️Read Full Mod info (Click here)
✍️ | Release by Balatan
━━━━━━━━━━━━━━━━━━━
📥Link : CLICK HERE TO DOWNLOAD
━━━━━━━━━━━━━━━━━━━
▶️Tutorial : How To Download Mod
━━━━━━━━━━━━━━━━━━━
🔄Official Channel ➜ @Mixrootmods
📱 Truecaller v26.8.6 [Gold] [Mod]
⚙│ Android: 8.0 and up #update
🔔
🅿️ │ Play Store / Official Site Link
━━━━━━━━━━━━━━━━━━━
☑ | Features & Mod Info ⭐
◉ Powerful Caller ID » know who’s calling
◉ Block spam + scam calls and SMS
◉ Stay protected from Scammerscallers
◉ Search for phone numbers with Dialer
◉ Advanced blocking & filtering options
◉ Can Use it as your text messaging app
◉ Know who viewed your profile
◉ Get the Premium badge on your profile
◉ Gold Features Unlocked, No ads
◉ Multi Languages & CPUs: Arm32/64
➡️Read Full Mod info(Click here)
✍️ | Release by Balatan
━━━━━━━━━━━━━━━━━━━
📥Link : CLICK HERE TO DOWNLOAD
━━━━━━━━━━━━━━━━━━━
▶️Tutorial : How To Download Mod
━━━━━━━━━━━━━━━━━━━
🔄Official Channel ➜ @Mixrootmods
📱│Remini v3.7.1299.202520143 (Pro)
⚙│ Android: 7.0 and up #update
🔔
🅿️ │ Play Store / Official Site Link
━━━━━━━━━━━━━━━━━━━
☑ | Features & Mod Info⭐
◉ Powerful Photo enhancer app in World
◉ Enhance blurry, pixelated photos to HD
◉ Auto recognize > enhance facial details
◉ Unblur photo and make photo clearer
◉ Repair old, blurry, scratched photos
◉ Enhance background and colors
◉ Pro Features Unlocked, No Ads
◉ Multi Languages & CPUs: Arm32/64
⚠️ Video Enhance feature is server-side
✍️ | Release by Mixroot
━━━━━━━━━━━━━━━━━━━
📥Link : CLICK HERE TO DOWNLOAD
━━━━━━━━━━━━━━━━━━━
▶️Tutorial : How To Download Mod
━━━━━━━━━━━━━━━━━━━
🔄Official Channel ➜ @Mixrootmods
📱 VPN - Super Unlimited Proxy v2.22.1 (Premium)
⚙│ Android: 8.0 and up #update
🔔
🅿️ │ Play Store / Official Site Link
━━━━━━━━━━━━━━━━━━━
☑ | Features & Mod Info⭐
◉ Worldwide stable and fast servers
◉ Best VPN app for Android device
◉ Secure your all online activities
◉ Remain anonymous online, safe
◉ Hide your ip address and location
◉ Unblock websites & applications
◉ Premium / Paid Features Unlocked
◉ Multi Languages & CPUs: Arm32/64
✍️ | Release by Mixroot
━━━━━━━━━━━━━━━━━━━
📥Link : CLICK HERE TO DOWNLOAD
━━━━━━━━━━━━━━━━━━━
▶️Tutorial : How To Download Mod
━━━━━━━━━━━━━━━━━━━
🔄Official Channel ➜ @Mixrootmods