TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

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

Резултати

Пронајдени 6 слични објави

Пребарај: #interaction

当前筛选 #interaction清除筛选

Ладно, уже только за это взаимодействие можно порекомендовать сообщество дизайнеров Ньюс в телеграме, которое организовал Женя Арутюнов с командой Продающий лендос с манифестом и промокодами тут Если что, это ребята, которые когда-то для Додо придумывали смищные фразочки и другие оч человечные взаимодейтсвия) 🎤Ссылки на утро — второй канал ⏲Устойчивый VPN за звезду #interaction@cogload#copywriting@cogload

Universe Mysteries 🪐

@cosmomyst · Post #376 · 05.10.2025 г., 12:21

🪐 The galaxy Arp 273, located about 300 million light-years away in the constellation Andromeda, is an extraordinary pair of interacting galaxies twisted into a shape that looks like a cosmic rose. One galaxy’s gravity is pulling and warping the other’s spiral arms, creating elegant loops and arcs that reveal the dramatic effects of galactic encounters in deep space. ✨ #galaxies⚡#interaction⚡#astronomy⚡#nasa⚡#galaxy⚡#stars⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #12 · 09.08.2025 г., 16:17

🌍 The geographic shell of the Earth is where the land, water, air, and life all meet and interact. This thin, dynamic layer makes our planet uniquely suited for life to thrive. ✨ #geography⚡#earthshell⚡#interaction⚡#nature⚡#earth 👉subscribe Amazing Geography🌍

Amazing Geography 🌍

@amazingeo · Post #690 · 14.04.2026 г., 20:31

🌍 In Japan, centuries-old forest areas called satoyama are shaped by human care for farming, wood, and water, blending wild nature and villages into landscapes rich in biodiversity and tradition. ✨ #interaction⚡#landscapes⚡#biodiversity⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #385 · 17.10.2025 г., 20:31

🌍 In Indonesia, ancient forests and rice terraces share land with villages, blending wild and human-shaped environments. This mix supports rare wildlife while feeding local communities. ✨ #interaction⚡#landscapes⚡#sustainability⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #460 · 17.11.2025 г., 20:31

🌍 In the Swiss Alps, ancient irrigation channels called "bisses" direct mountain water through villages and fields. These hand-built waterways have shaped both local ecosystems and farming for centuries. ✨ #interaction⚡#society⚡#mountains⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​