Что делать если нужно поставить какую-то 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
🔠
🔠
🔠 Keychains can be found HERE
🔠
🔠
🔠 3D Printed Custom Night Lights (you send your image and I'll make it happen)
Offering custom 3D print services. Just message me for anything you may need (@teamanons1)
🔠
🔠
🔠 - 10g Year of the Snake Bill Shaped Bars 🐍
🔠
🔠
🔠- Premium Copper on website
1oz Colorized Patriotic Bars
1oz Silver Cards (different styles)
Back in stock 1g Team Anon Bars
👉 (@pmkllc)
Introducing 🔠🔠🔠
🔤🔤🔤🔤🔤🔤🔤 on the website here 👇
https://precious-metal-trump-notes.myshopify.com/collections/pmk-raffles?utm_campaign=share_orders&utm_content=android&utm_medium=product-links
Just click SHOP ALL on website to view ALL available products.
Check out all the items featured on Capt Kyle's Telegram 👇
https://preciousmetalkeepsakes.com/collections/capt-kyles-featured-products
Also. If you have a bigger budget and want some heavy metal. Please just message me (@teamanons1) or text me directly (number lower on post) prices are way lower for bigger budget!
I offer a WIDE variety of different types of Precious Metals from 1 gram to kilos (kilos are not on website only @pmkllc) always sigma tested and verified genuine .999 fs/fg or your money back! GUARNTEED!
Www.preciousmetalkeepsakes.com
Just click 🔤🔤🔤🔤🔤🔤🔤here
For any questions or concerns call or text anytime (502-252-1039) I'll be glad to help in anyway or message me here on telegram
📱 (@teamanons1)
I always have 👇
✅10oz bars of silver
✅5oz bars of silver
✅1oz Copper rounds. Several designs to choose from
✅Lots of other Precious Metal items available
⏰
🟥
⏰
🟥
⏰
🟥
⏰
🟥
⏰
🟥
Www.preciousmetalkeepsakes.com
🟥
⏰
🟥
⏰
🟥
⏰
🟥
⏰
🟥
⏰
➡️I have BETTER Prices and items not on website here @pmkllc
To follow new arrivals/Giveaways RAFFLES and everything Precious Metals Join our telegram page here (@pmkllc)
😇
🥰
🥰
🥰
🥰
🥰
🥰
🥰
😇
➡️Go to @pmkllc if your interested in having a chance of winning precious metals for a fraction of the price
➡️RAFFLES
I met Capt Kyle at the beginning of my Awakening journey and he has been nice enough to allow me to share my website on his channel and has never asked for anything in return. I greatly appreciate you Capt Kyle 🙏
Www.preciousmetalkeepsakes.com
#silver#preciousmetals#ta#staxxx
🦅🇺🇸💪🔥
🔠
🔠
🔠 Keychains can be found HERE
🔠
🔠
🔠 3D Printed Custom Night Lights (you send your image and I'll make it happen)
Offering custom 3D print services. Just message me for anything you may need (@teamanons1)
🔠
🔠
🔠 - 10g Year of the Snake Bill Shaped Bars 🐍
🔠
🔠
🔠- Premium Copper on website
1oz Colorized Patriotic Bars
1oz Silver Cards (different styles)
Back in stock 1g Team Anon Bars
👉 (@pmkllc)
Introducing 🔠🔠🔠
🔤🔤🔤🔤🔤🔤🔤 on the website here 👇
https://precious-metal-trump-notes.myshopify.com/collections/pmk-raffles?utm_campaign=share_orders&utm_content=android&utm_medium=product-links
Just click SHOP ALL on website to view ALL available products.
Check out all the items featured on Capt Kyle's Telegram 👇
https://preciousmetalkeepsakes.com/collections/capt-kyles-featured-products
Also. If you have a bigger budget and want some heavy metal. Please just message me (@teamanons1) or text me directly (number lower on post) prices are way lower for bigger budget!
I offer a WIDE variety of different types of Precious Metals from 1 gram to kilos (kilos are not on website only @pmkllc) always sigma tested and verified genuine .999 fs/fg or your money back! GUARNTEED!
Www.preciousmetalkeepsakes.com
Just click 🔤🔤🔤🔤🔤🔤🔤here
For any questions or concerns call or text anytime (502-252-1039) I'll be glad to help in anyway or message me here on telegram
📱 (@teamanons1)
I always have 👇
✅10oz bars of silver
✅5oz bars of silver
✅1oz Copper rounds. Several designs to choose from
✅Lots of other Precious Metal items available
⏰
🟥
⏰
🟥
⏰
🟥
⏰
🟥
⏰
🟥
Www.preciousmetalkeepsakes.com
🟥
⏰
🟥
⏰
🟥
⏰
🟥
⏰
🟥
⏰
➡️I have BETTER Prices and items not on website here @pmkllc
To follow new arrivals/Giveaways RAFFLES and everything Precious Metals Join our telegram page here (@pmkllc)
😇
🥰
🥰
🥰
🥰
🥰
🥰
🥰
😇
➡️Go to @pmkllc if your interested in having a chance of winning precious metals for a fraction of the price
➡️RAFFLES
I met Capt Kyle at the beginning of my Awakening journey and he has been nice enough to allow me to share my website on his channel and has never asked for anything in return. I greatly appreciate you Capt Kyle 🙏
Www.preciousmetalkeepsakes.com
#silver#preciousmetals#ta#staxxx
🦅🇺🇸💪🔥
🔠
🔠
🔠 Keychains can be found HERE
🔠
🔠
🔠 3D Printed Custom Night Lights (you send your image and I'll make it happen)
Offering custom 3D print services. Just message me for anything you may need (@teamanons1)
🔠
🔠
🔠 - 10g Year of the Snake Bill Shaped Bars 🐍
🔠
🔠
🔠- Premium Copper on website
1oz Colorized Patriotic Bars
1oz Silver Cards (different styles)
Back in stock 1g Team Anon Bars
👉 (@pmkllc)
Introducing 🔠🔠🔠
🔤🔤🔤🔤🔤🔤🔤 on the website here 👇
https://precious-metal-trump-notes.myshopify.com/collections/pmk-raffles?utm_campaign=share_orders&utm_content=android&utm_medium=product-links
Just click SHOP ALL on website to view ALL available products.
Check out all the items featured on Capt Kyle's Telegram 👇
https://preciousmetalkeepsakes.com/collections/capt-kyles-featured-products
Also. If you have a bigger budget and want some heavy metal. Please just message me (@teamanons1) or text me directly (number lower on post) prices are way lower for bigger budget!
I offer a WIDE variety of different types of Precious Metals from 1 gram to kilos (kilos are not on website only @pmkllc) always sigma tested and verified genuine .999 fs/fg or your money back! GUARNTEED!
Www.preciousmetalkeepsakes.com
Just click 🔤🔤🔤🔤🔤🔤🔤here
For any questions or concerns call or text anytime (502-252-1039) I'll be glad to help in anyway or message me here on telegram
📱 (@teamanons1)
I always have 👇
✅10oz bars of silver
✅5oz bars of silver
✅1oz Copper rounds. Several designs to choose from
✅Lots of other Precious Metal items available
⏰
🟥
⏰
🟥
⏰
🟥
⏰
🟥
⏰
🟥
Www.preciousmetalkeepsakes.com
🟥
⏰
🟥
⏰
🟥
⏰
🟥
⏰
🟥
⏰
➡️I have BETTER Prices and items not on website here @pmkllc
To follow new arrivals/Giveaways RAFFLES and everything Precious Metals Join our telegram page here (@pmkllc)
😇
🥰
🥰
🥰
🥰
🥰
🥰
🥰
😇
➡️Go to @pmkllc if your interested in having a chance of winning precious metals for a fraction of the price
➡️RAFFLES
I met Capt Kyle at the beginning of my Awakening journey and he has been nice enough to allow me to share my website on his channel and has never asked for anything in return. I greatly appreciate you Capt Kyle 🙏
Www.preciousmetalkeepsakes.com
#silver#preciousmetals#ta#staxxx
🦅🇺🇸💪🔥
🚀 PRECIOUS METALS | Silver Sees Intraday Rise Amid Decline in Crypto Volatility
Silver experienced a 1.49% increase in its intraday trading, reaching $76.364 per ounce. According to NS3.AI, the BTC Volatility Index decreased by 1.01%, settling at 44.20, while the ETH Volatility Index saw a 1.19% decline, reaching 63.83. These movements indicate a shift in market dynamics, with precious metals gaining traction as cryptocurrency volatility diminishes.
#PreciousMetals#Silver#Crypto#Volatility#MarketTrends#BTC#ETH
🚀 PRECIOUS METALS | Spot Gold Reaches $4,760 per Ounce with 0.86% Daily Increase
Spot gold prices have risen to $4,760 per ounce, marking a 0.86% increase within the day. According to Jin10, this upward movement reflects ongoing market dynamics influencing precious metals.
#PreciousMetals#Gold#SpotGold#MarketUpdate#CommodityPrices
🚀 PRECIOUS METALS | Gold and Silver Call Options Show Cautious Sentiment
Gold call options continue to be positioned for an upward move, although enthusiasm for betting on a significant rise remains moderate. According to Jin10, silver call options exhibit a more cautious stance, with limited bets placed on substantial upward movements.
#preciousmetals#gold#silver#calloptions#cautioussentiment
🚀 Silver Faces Technical Resistance Amid Analyst Predictions
Silver is encountering potential technical resistance around the $90 mark, according to analysts. Rashad Hajiyev has outlined a scenario where silver could reach approximately $300. According to NS3.AI, The Long Investor noted that silver previously peaked near $121 following a January chart call and is currently trading around $74, which the analyst considers attractive once more.
#Silver#TechnicalResistance#AnalystPredictions#PreciousMetals#Investment#Trading
🚀 Czech Central Bank Increases Gold Reserves to 76.6 Tons
As of the end of March 2026, the Czech Central Bank's gold reserves have reached nearly 77 tons, specifically 76.6 tons, according to data from the Czech Central Bank. According to Jin10, the World Gold Council reported that in February, the Czech Central Bank's gold reserves were approximately 75 tons, indicating an increase of 2 tons in February. The Czech Central Bank aims to increase its gold reserves to 100 tons by 2028.
#CzechCentralBank#GoldReserves#Gold#MonetaryPolicy#Finance#Economy#PreciousMetals
🚀 PRECIOUS METALS | Gold and Silver Prices Rise, Brent Crude Oil Declines
Gold prices have surged, reaching $4,800 per ounce, marking a 1.71% increase. According to Odaily, silver also experienced a significant rise, climbing by $2.00 to $76.10 per ounce, a 2.70% increase. In contrast, Brent crude oil saw a decline of over 1.00%, currently priced at $93.47 per barrel.
#gold#silver#preciousmetals#brentcrudeoil#oilprices#marketupdate#commodities
🚀 PRECIOUS METALS | Gold Prices in Uncertain Range Amid Middle East Tensions
Gold prices are currently positioned in the middle of a fluctuating range, with short-term predictions remaining uncertain. According to Jin10, the market is bracing for a potential escalation in Middle East conflicts, which has led to gold prices opening lower during the Asian trading session. Analysts suggest that the price of gold may continue to hover within this range, making it difficult to predict future movements in the short term.
#GoldPrices#MiddleEastTensions#PreciousMetals#MarketUncertainty#Gold#TradingSession
🚀 PRECIOUS METALS | Chinese Gold Jewelry Prices Drop Significantly
Gold jewelry prices in China have seen a notable decline today, according to Jin10. Several brands have reduced their prices by approximately 25 yuan compared to yesterday. The current prices are mostly in the range of 1,445 yuan to 1,450 yuan per gram.
#preciousmetals#gold#chinagold#goldprices#jewelryprices#marketnews
🚀 PRECIOUS METALS | Iran to Resume Gold Business Operations Nationwide Amid Ceasefire, Iranian Media Reports
Iranian media reports that Iran has decided to fully and formally resume operations of all gold business units nationwide starting Saturday, in light of the current ceasefire. According to Jin10, this decision marks a significant step in the country's efforts to stabilize its economy and restore normalcy in the gold market. The move comes as part of broader measures to enhance economic activities and support the precious metals sector, which has been impacted by recent geopolitical tensions. The resumption of gold business operations is expected to boost local trade and provide a positive outlook for the industry.
#Iran#Gold#PreciousMetals#Ceasefire#Economy#Geopolitics#GoldMarket#Trade