Мы уже знаем, что на текущую сессию интерпретатора изменение PYTHONPATH никак не повлияет. Но если вы запустите дочерний процесс, то он унаследует окружение текущего процесса, а значит и изменения в любых переменных будут на него влиять.
Вот небольшой пример:
Объявляем переменную
user@host:~$ export PYTHONPATH=/path1
Запускаем интерпретатор
user@host:~$ python3
Проверим что в sys.path
>>> import sys
>>> print(sys.path)
['', '/path1', '/usr/lib/...', ...]
Добавляем что-то в переменную
>>> import os
>>> os.emviron['PYTHONPATH'] = '/path1:/path2'
>>> print(sys.path)
['', '/path1', '/usr/lib/...', ...]
Изменений нет. Но давайте запустим дочерний процесс и посмотрим там
>>> os.system('python3')
# теперь мы находимся в другом процессе
>>> import sys
>>> print(sys.path)
['', '/path1', '/path2', '/usr/lib/...', ...]
Тоже самое будет и с subprocess, так как по умолчанию текущее окружение тоже наследуется.
>>> import subprocess
>>> subprocess.call(['python3', '-c', 'import sys;print(sys.path)'])
['', '/path1', '/path2', '/usr/lib/...', ...]
______________________
Лучшей практикой является передача энвайронмента явно через аргумент env!
import subprocess
subprocess.call(cmd, env={'PYTHONPATH': '...'})
Это поможет точно понимать какое окружение будет у запускаемого процесса и при этом не изменять окружение текущего процесса.
#basic
#APE/USDT analysis :
#APE is currently demonstrating a bullish trend, characterized by higher highs and higher lows, with strong support along the trendline. The price has recently bounced back and successfully broken out of the trendline, suggesting a continuation of bullish momentum. It is anticipated that the price will test previous highs moving forward.
TF : 1D
Entry : $1.330
Target : $1.930
SL : $0.988
#APE/USDT analysis :
#APE is currently in an upward trend, consistently achieving new highs while trading above the 200-period exponential moving average (EMA). The price is currently consolidating above a support zone that has been tested multiple times. It is expected that the price will bounce off this level and continue its upward trajectory, with the potential to revisit previous highs.
TF : 30min
Entry : $1.890
Target : $2.160
SL : $1.760
#APE/USDT analysis :
#APE is currently in a downtrend, trading consistently below the 200 EMA. The price is currently within a resistance zone. It is anticipated to face rejection from this zone and continue its downward trajectory.
It is advisable to await the breakout of the $0.580 level for a short position, with the previous swing low likely to be tested.
TF : 30min
Entry : $0.580
Target : $0.537 and $0.509
SL : $0.607
📈Инсайдер «0x0b8a» превратил $174 000 в $2,45 млн (14x) всего за один день
Он открыл лонг по #APE прямо перед ростом цены и вышел почти на самом пике, зафиксировав $1,79 млн. Сразу после этого открыл шорт и заработал еще $488 000 – lookonchain.
🟪Чат▫️Новостной канал▫️Премиум сигналы
#APE
ApeCoin is completing a cup and handle formation on the daily chart🧐
Also, the price has breached above the descending resistancelevel and the MA 50
A move above the neckline could drive the price toward targets at $0.85, $1.00, $1.20, and $1.36🚀
#APE
ApeCoin is moving towards a key resistance level, showing potential for a significant move
A breakout from the descending channel could trigger a 100-120% bullish wave in the mid-term️