@QuietWorld · Post #6230 · 12.03.2019 г., 07:12
Don’t look back and wonder why things went wrong. Don’t regret not doing more. It happened for a reason. Your better days are ahead of you. #motivation#assurance @quietworld🍃
Hashtags
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #201 · 13 јан.
Мы уже знаем, что на текущую сессию интерпретатора изменение 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
Hashtags
Пребарај: #assurance
@QuietWorld · Post #6230 · 12.03.2019 г., 07:12
Don’t look back and wonder why things went wrong. Don’t regret not doing more. It happened for a reason. Your better days are ahead of you. #motivation#assurance @quietworld🍃
Hashtags
@QuietWorld · Post #6459 · 15.05.2019 г., 04:49
#assurance#selfreminder @quietworld🍃
Hashtags
@QuietWorld · Post #6864 · 05.11.2019 г., 10:23
Two years being passive is just a blink of an eye 😉 Two years moving towards a big goal every single day is plenty of time 😮 There is nothing that cannot be accomplished in two years with enough effort 😎 #life#motivation#assurance @quietworld🍃
Hashtags
@QuietWorld · Post #6231 · 12.03.2019 г., 11:15
“When it comes to breaking old habits and starting new ones, remember to be patient with yourself. You’ve got to expect it’s going to take time and effort before you see lasting results.” #quotes#assurance#motivation @quietworld🍃
Hashtags
@QuietWorld · Post #7195 · 16.02.2020 г., 10:05
#assurance#selfcare#selfreminder @quietworld🍃
Hashtags
@QuietWorld · Post #7359 · 08.06.2020 г., 03:08
to anyone who might need this at this moment🌹 #reminder#selfcare#assurance @quieworld🍃
Hashtags
@QuietWorld · Post #7223 · 21.03.2020 г., 04:07
It is not a sin to be upset; with someone, with a situation, with yourself. Give yourself time to absorb what you're feeling until you're ready to move to where there's growth. #selfreminder#selfcare#assurance#wisdom @quietworld🍃
@QuietWorld · Post #6856 · 04.11.2019 г., 13:33
Appreciate where you are in your journey, even if it's not where you want to be - because every season serves a purpose. #life#quotes#assurance#gratitude#happiness @quietworld🍃
@QuietWorld · Post #7338 · 04.06.2020 г., 15:56
Things to Remember🍃 #thingstoremember#quotes#selfreminder#selfcare#life#assurance @quietworld🍃
@QuietWorld · Post #7341 · 05.06.2020 г., 15:02
#thingstoremember#life#selfcare#selfreminder#assurance#solitude @quietworld🍃