Что делать если нужно поставить какую-то 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
✈️ TON has been successfully updated!
Last night, the TON network was updated.
The fees are now less than 0.0005$ , making the network cheaper for transactions like Solana!
The cost of sending Ton
0.000388 ($0.00052)
USDT The cost of sending
0.0010 ($0.00142)
#MTONGA🗽
Most people see TON at $2 and think "nothing's happening."
I see a $10B ecosystem that's about to wake up.🐂 And I'm not leaving my laptop until you see it too.
💎The TON ecosystem is going through a major transformation right now, and this is only the start. Thanks to Pavel Durov (@durov), TON has finally come alive. The MAKE TON GREAT AGAIN movement #MTONGA🪙has officially taken the wheel, and from here, things only get better.
So where does TON stand today?
Current Fully Diluted Valuation: ~$10.4B
Price per TON: $2
What's coming next?
In my view, TON's market cap should, at the very minimum, match Telegram's valuation. And how much is Telegram actually worth? Trust me… way, way more than $10 billion🌎
What should we be doing right now?
⚙Just focus. Build. Grow your projects. Don't get distracted by short-term price action.
Remember: long-term vision always beats short-term speculation.
🏆The believers stay. And the believers win.
⭐️Top gear on TonMap — board update
🥇 Robert — 2218 lands
🥈 Frank — 709 lands
🥉 Yourfriiend — 564 lands
Robert has been holding the top spot for months. The Chinese community keeps quietly showing up — we see it in every new wave of purchases.
The gap between #1 and #2 is 3x. Biggest it’s ever been on the map.
Why a big hold actually matters:
➖ more pixels = more PIX farmed = more TON on the way out
➖ visibility: your piece is what everyone sees when they open TonMap
➖ Phase 4 will pay the biggest holders a serious share of TON. Steady drip, for years
To take Robert’s crown you’d need at least 2,219 pixels. To break into the top 3 — around 600 is enough.
X | Fam | Map | FAQ | Pages#MTONGA
⭐️The TON Airdrop #10 was a hit! Each winner scored 1 TON straight to their wallets — and now those pixels are completely free for their owners!
The more pixels you own, the more drops you get. This is just the beginning — your land should work for you!
🤩transactions
X | Fam | Map | FAQ | Pages#MTONGA
⭐️We see growing interest from the Chinese community — Chinese-language pixels are popping up on the map, more holders joining in. Created a dedicated Chinese chat for easier communication: [link]. Welcome aboard
我们看到中国社区对项目的兴趣越来越大 — 地图上出现了越来越多中文像素,中国持有者也在不断加入。我们专门开了一个中文聊天群,方便大家交流:[link]
X | Fam | Map | FAQ | Pages#MTONGA
👉Community Treasury: 17,040 TON.
Every pixel adds to the Treasury. By Phase 4 the Treasury will grow to 1,000,000 TON. Yield goes to land holders.
First project of its kind on Telegram. Only one on TON.
X | Fam | Map | FAQ | Pages#MTONGA
📱 Today is the last day of the current $TON airdrop zone in the center of the map.
After that, the airdrop zone will move to a new area.
If you don’t have pixels in the current zone yet, now is the time to join this round and then participate in the next one too 💎
X | Fam | Map | FAQ | Pages#MTONGA
📱 How to earn TON rewards on TonMap
Buy pixels → Farm PIX → Upgrade pixels → Swap PIX to #TON → Final TON holder rewards
Every pixel is limited digital land.
1 pixel = 1 TON now.
Only 1,000,000 pixels will ever exist.
Claim your place before mass awareness begins.
X | Fam | Map | FAQ | Pages#MTONGA
💎 TON gets a major update
Pavel Durov announced that TON network fees have been reduced by 6x, almost to zero.
The next step: Telegram plans to take a leading role in TON, replacing TON Foundation as the main driving force and becoming the network’s largest validator⚡️
Upcoming focus:
• new TON website
• developer tools
• performance upgrades
• stronger Telegram integration
The news triggered strong market attention, with TON showing significant growth over the last 24 hours 📈
Not financial advice. DYOR.
#TON#MTONGA#news
🚀 Telegram's TON Blockchain Achieves Significant Speed Upgrade
Telegram founder Pavel Durov announced a major upgrade to the TON blockchain, significantly enhancing its processing speed. According to Foresight News, the upgrade has increased block generation rates by six times and achieved sub-second transaction confirmations. Durov stated that this is the first of seven steps in his 'Make TON Great Again' (MTONGA) plan. The next step aims to reduce the already relatively low transaction fees by approximately six times to further improve network performance and cost competitiveness.
#Telegram#TONBlockchain#PavelDurov#SpeedUpgrade#Blockchain#TransactionSpeed#MTONGA#ForesightNews#SubSecondConfirmations#TransactionFees#NetworkPerformance