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

Резултати

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

Пребарај: #telescopes

当前筛选 #telescopes清除筛选
Universe Mysteries 🪐

@cosmomyst · Post #560 · 15.12.2025 г., 22:21

🪐 The James Webb Space Telescope has observed the galaxy JADES-GS-z7-01-QU, one of the most distant “quiescent” galaxies ever found, meaning it has stopped making new stars even though its light began traveling to us over 13 billion years ago. Seeing JADES-GS-z7-01-QU lets scientists study how some galaxies aged and shut down astonishingly early, offering a rare glimpse into the universe’s remote past when cosmic structures were just beginning to take shape. ✨ #galaxies⚡#distance⚡#telescopes⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #284 · 17.09.2025 г., 03:11

🪐 The James Webb Space Telescope discovered that the distant galaxy JWST-ER1 has an unexpected bar-shaped structure, even though it formed just 2 billion years after the Big Bang. Bars are elongated collections of stars that stretch across the centers of galaxies, and finding one so early suggests galaxies began organizing themselves much faster than scientists once thought. ✨ #galaxies⚡#telescopes⚡#discovery⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries ​

Universe Mysteries 🪐

@cosmomyst · Post #442 · 18.10.2025 г., 15:21

🪐 Scientists at the SETI Institute have used the Allen Telescope Array to listen for possible signs of alien technology from over 20,000 star systems, including those with known exoplanets like Gliese 581 and Kepler-452. Although no artificial signals have been confirmed, this real-world search for extraterrestrial intelligence uses radio telescopes to scan for narrowband signals—kinds of signals rarely produced by nature, but which could indicate advanced technology elsewhere in the galaxy. ✨ #aliens⚡#radio⚡#telescopes⚡#exoplanets⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​