Что делать если нужно поставить какую-то 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
🐠 Kingfisher traders, wanna snag the BIGGEST $BTC fishes? 🐦
Use the GEX "sonar" chart, and look at the options whales!
🔵 Blue water = Calm fishing, easy gains.
🔴 Red water = Choppy, risky dives.
⚪️ Clear water? ⚠️ Big moves brewing, watch for any change in weather!
#BTC#GEX#CryptoTrading#OptionsTrading
BIT Exchange has launched the world’s 1st #ADA/USD #OptionsTrading🥳
▫️Denominated & settled in USD
▫️1-10x leverage
▫️Available on web, mobile app & API
▫️More #altcoin options are coming
We are excited to be part of this strategic collaboration with BIT and Darley Technologies to make #ADAOptionsTrading possible ✨
Read more here.
🚀 Booked ₹1.37+ Lakh Profit! 💰
Another great day in the markets with smart entries & exits. 📈
Check out the power of precision trading! 🔥
🧠 Join my private trading community for real-time insights, setups, and mentorship. Whether you're new or experienced — you’ll level up fast.
👇 Click to join now
🔗https://t.me/+7emcw1k0H_U4ZDg9
📊 Stay ahead, trade smart. 💯
#BankNifty#OptionsTrading#StockMarketIndia#TradeLab#Profits
🚀 Booked ₹1.37+ Lakh Profit! 💰
Another great day in the markets with smart entries & exits. 📈
Check out the power of precision trading! 🔥
🧠 Join my private trading community for real-time insights, setups, and mentorship. Whether you're new or experienced — you’ll level up fast.
👇 Click to join now
🔗https://t.me/+7emcw1k0H_U4ZDg9
📊 Stay ahead, trade smart. 💯
#BankNifty#OptionsTrading#StockMarketIndia#TradeLab#Profits
🚀 Booked ₹1.37+ Lakh Profit! 💰
Another great day in the markets with smart entries & exits. 📈
Check out the power of precision trading! 🔥
🧠 Join my private trading community for real-time insights, setups, and mentorship. Whether you're new or experienced — you’ll level up fast.
👇 Click to join now
🔗https://t.me/bankniftygo
📊 Stay ahead, trade smart. 💯
#BankNifty#OptionsTrading#StockMarketIndia#TradeLab#Profits
https://x.com/priceactiongann/status/1810583536312647828
#nifty#BankNifty
my personal rules i see before taking trades, few of them have posted here!
my recent research studies going on about time!
make notes and study!
trading is easy but work behind the scenes is the real work done, sharpen Ur skills and study always!
#trading#priceaction#stockmarket#nifty50#OptionsTrading#research
https://x.com/priceactiongann/status/1810583536312647828
https://x.com/priceactiongann/status/1806296904663228873
#nifty
23910 done in nifty #timecycle helped from 24 th,
price will decide here now, OLHC etc.
weekly price close will be very interesting!
, when #banknifty reaches 54583 u will see some magic! wait and see!
#stocks#stockmarket#stockmarketindia#gann#OptionsTrading
https://x.com/priceactiongann/status/1837115028920476072
#nifty50#banknifty
1.First of all Congrats if u have foreseen this well in advance! then congrats to other researchers and forecasters here!
keep it up! 🔮👏
2.Once it breached today bank nifty and nifty it is officially in new zone of cycle which is helping bank nifty cycle to complete! 📈🚀
(its not in my edge and after it crossed it confirmed my research )
3.Nifty Level Next Top Deciding 26010 and 26175! 📍
which coincides with bank nifty level 54583.60! 📍
We CANNOT IGNORE THE OBVIOUS UPSIDE levels!
4.THIS AREA or particular above 25300 IS NOT IN Ours ZONE AT ALL OR OUR EDGE
(so we ignored upside at all costs as we focus on selective areas only which iam good at)
5.THIS EXTRA ZONE above the 25300 and 25192 is BECAUSE OF BANK NIFTY CYCLES TRYING TO COMPLETE its own cycle to 54583.60.
6.Both corelating to complete it!(which is missed to see)(will do better work and update next time considering all elements)
7.In gold i see only one cycle but in this case may be another one similar to nifty like gift nifty bank nifty , Sensex all plays crucial role and validates and helps each other markets too.(trust me ,too much of work doing all these) 🌟
Every time when long term levels coincides with nifty and bank nifty it gave us at least 500 to 800 points
8.Many mistakes were done by looking very shorter term or in a short term for Long term targets.
just iam looking few 500 plus points once price is reached. sensible way to grab the vibrations.
9.Bank nifty averages 1000 to 2000 points when confluence and big levels are reached.📊
(51860 we saw 2000 points drop last time and if taken from last top to bottom it was 3600 points compared to nifty bank nifty is real good movements)📊
10.When during learning phase more winning will only boost your ego, losing will give u lots of learning.
iam trying to learn at the same time lose less too.
11.All the short term cycles recent times in nifty and bank nifty as marked in charts holded for short time but taken out again easily next day,closing above and retest on top to go up more.(look charts)
same cycles as nifty , bank nifty cycles
1.56268
2.54583
3.54400
4.51860 📝
12.if u still think the levels wont work 23900 or 23535(longer term levels for months years to come)
my work is sometimes short term cycles but i see very much ahead in future, it is must for every trader to learn such long term skills. 🗺
13.WHICH NEVER FAILED IN PAST SO SOONER OR LATER THIS ENTIRE 23900 AND 23535 SHOULD BE REACHED FOR LONGER TERM FOR SURE.
when this cycle fails either it takes on top and go up and again it will go back to where it started so given levels in long term is surely pending downside!(thats y levels are called deciding levels, so it vibrates and decides there) 🔄
14.KEEP THIS FOR VERY LONG TERM AND EVERY LEVEL IS CONFIRMATION AND DECIDING FOR SURE.
All my analysis are not signals or recommendation so trade or use at ur own risk here, i post my studies and research here only!⚠️
Thanks for the support always, please do like and repost to many, More updates are upcoming.
#stocks#nifty50#stock#stockmarket#OptionsTrading#trading#gann#priceaction#stockmarkets#StockMarketNews
#StockMarketIndia
https://x.com/priceactiongann/status/1837115028920476072