Что делать если нужно поставить какую-то 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
https://x.com/priceactiongann/status/1870116486494466125
#nifty50#nifty#gold#xauusd
New Course:
"Price Calculus" - Master the Art of Market Analysis
Comprehensive Learning Path:
1. Patterns: Dive into the most critical and frequently used patterns in trading.
2. Market Dynamics: Understand the branches of price calculus and their application under various market conditions.
3. Structural Analysis: Learn how patterns and structures dictate price movements.
Top-Down Analysis:
1. Chart Mastery: Detailed analysis from higher to lower time frames.
2. Market Characteristics: Essential knowledge for long-term survival in trading.
Gann Techniques:
1. Gann Square Utilization: Learn the intricacies of Gann Square and its application in charting.
2. Square Relationships: Explore the relation between multiple squares and their impact on price.
3. Square Numbers : Practical use of square numbers and the Square of 9.
Integrated Approach:
1. Correlation of Concepts: How Gann's concepts integrate with price patterns to form a cohesive analysis method.
2. Mastery of Price Calculus: Combine all elements into a complete methodology for mastering price movements.
Contact in Telegram and X alone:
Available by the end of January or first week of 2025.
Give your maximum support thanks 🙏❤️🙏
#banknifty#stockmarket#stocks#gann#trading#priceaction
#newcourse#course#astrology#financialastrology#numerology
https://x.com/priceactiongann/status/1870116486494466125
#nifty50#nifty#gold#xauusd
New Course:
"Price Calculus" - Master the Art of Market Analysis
Comprehensive Learning Path:
1. Patterns: Dive into the most critical and frequently used patterns in trading.
2. Market Dynamics: Understand the branches of price calculus and their application under various market conditions.
3. Structural Analysis: Learn how patterns and structures dictate price movements.
Top-Down Analysis:
1. Chart Mastery: Detailed analysis from higher to lower time frames.
2. Market Characteristics: Essential knowledge for long-term survival in trading.
Gann Techniques:
1. Gann Square Utilization: Learn the intricacies of Gann Square and its application in charting.
2. Square Relationships: Explore the relation between multiple squares and their impact on price.
3. Square Numbers : Practical use of square numbers and the Square of 9.
Integrated Approach:
1. Correlation of Concepts: How Gann's concepts integrate with price patterns to form a cohesive analysis method.
2. Mastery of Price Calculus: Combine all elements into a complete methodology for mastering price movements.
Contact in Telegram and X alone:
Available by the end of January or first week of 2025.
Give your maximum support thanks 🙏❤️🙏
#banknifty#stockmarket#stocks#gann#trading#priceaction
#newcourse#course#astrology#financialastrology#numerology
https://x.com/priceactiongann/status/1820035146722189673
#nifty#gann
Most Important:
17568/108=162.6666
its same as 1.62 = 1.618 or same
Nifty high is connected to this cycle in time
from nifty low March 24, 2020 to December 1 ,2020 =668 bars or trading days
668x1.618= 1080.1 or 1081 perfect high to all time high august 1.
#timecycles
Dec 1 there was high clean on top, (important for future also)
666 is very important as 1080/666=1.62
Nifty strongly works on 432 between 20 square 400 to 21 square 441 any markets u can see high or low there
555,666,777 (check these cycle in nifty it should give nice high and lows) also its midpoints.
400 to 441
(144 reverse is 441) 12 square and 21 square)
576 (23 and 24 square)
576/2 =288 (2x144)
#numerology
cycles of 108,144,216,270,288,432
previous time cycle dates i have posted which clearly shows the above cycles on charts which i used to find the august 1 and 2 date! #time
432/1.618 =266.99 (tunnel book cycle number 266)
270 is closely relate to 90.
267/2 =134 around and
if u divide 267/1.618 = 165
432 #price
In any circle or square half is very important gann also did that
1/2 ,1/4,1/8
1080/2=720
1080/4=270
1080/8=135
(from #nifty50 chart)
hidden cycle:
555+165=720(half of 144)
so from any high directly it gives numbers sometimes u have to add the waves to get the numbers and its vibrational cycles which are hidden
hidden cycle:
113 square and 75 square
=18,394
sqrt(18394)= 135.62
(135x2=270)
hidden cycle:
122+148=270
SQUARE (122) + SQUARE (148)
=36,788
sqrt(36788) =191 almost. high of nifty
(chart see)
#financialastrology#astrology#astronomy
Many more are there these are just few examples.
study again and again and practice more!
if found helpful do like, comment and repost more!
#stocks#stockmarket#stockmarketcrash#economy#trading#priceaction
https://x.com/priceactiongann/status/1820035146722189673
https://x.com/priceactiongann/status/1819774789399224477
#nifty#nifty50#stocks
Price and Time Relation:
strong connection and cycle of 144 and 108 or 1440 and 1080
Nifty low of march 24 , 2020 = 7511 price
Nifty all time high august 1 2024=25078 price
price moved from low to high or total range from low to high is 17567
#trading
Price 17567/144= 122
#priceaction
122x144=17658
Time taken to reach is 1081 bars and 1591 days
1080 trading days or bars to reach from low to high
1080/144=7.5
1080/1440=.75
17657 is price moved and 1081 is time taken
2.177860006167129
17657/1081 =16.33395004625347(163)
16.33395004625347/7.5 =2.177860006167129(216 or 217)
2.177860006167129x5 =10.88930003083565(108 or 1080)
1080 or 1081 days to reach from low to high!
#Stocks
90 years cycle the great cycle is 90x12 =1080 months
18x60(great cycle) = 1080
circle 360 =3 (holytrinity)x360 =1080
3x3x3= 27
27x4 =108
108/3=36
666=6x6x6
also 108 is 18 degree cancer
108 is half of 216 (144 + 72) and its 1/4 of 432
#numerology#financialastrology#astrology
1080/666=1.62
If this post gets 108 likes and 108 comments i will post more calculations
1080/666=1.62 #time#price
one important cycle about above number and how it connects to nifty high
it will deal with other number like 555,666,777 etc.
more u will get in that too once reaches 108 likes and 108 comments here.
#stockmarket#stockmarketcrash#economy#timecycle#pricecycle#gann#cycles
https://x.com/priceactiongann/status/1819774789399224477