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

Резултати

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

Пребарај: #monotreme

当前筛选 #monotreme清除筛选
Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40486 · 06.01.2026 г., 07:03

Echidnas are fascinating egg-laying mammals native to Australia and New Guinea. There are three surviving species. They belong to a group called monotremes, which are unique because they lay eggs instead of giving birth to live young. Echidnas have spiky coats like a hedgehog and long, sticky tongues to catch ants and termites. Despite their spiky appearance, they are shy and solitary creatures. They dig burrows and are excellent swimmers too! 🦔🥚🍼🇦🇺 [Read more 1] [Read more 2] [Read more 3] @googlefactss #Echidna#Monotreme#AustralianWildlife#NatureFacts

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40534 · 13.01.2026 г., 11:03

The platypus is a monotreme native to eastern Australia and Tasmania. It lays eggs but has a unique mix of features: a duck-like bill, webbed feet, a beaver-like tail, and dense waterproof fur. Platypuses are excellent swimmers and use electroreception in their bills to detect prey underwater. They’re one of the few venomous mammals—the males have venomous spurs on their hind legs. 🦆🦫🥚🍼🇦🇺 [Read more] @googlefactss #Platypus#Monotreme#UniqueAnimals#AustralianWildlife