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 слични објави

Пребарај: #smartspeakers

当前筛选 #smartspeakers清除筛选
🦅 [ perspective ix ]

@perspectiveix · Post #1686 · 03.12.2018 г., 10:30

🔈Most Common Smart Speaker Usage People are doing plenty of things with voice commands on their #SmartSpeakers, but shopping isn’t really one of them. Only about a quarter to a third of U.S. smart speaker owners have ever purchased something using voice. Very few do so on a regular basis. An Information article this summer said just 2 percent of #Alexa owners had made a purchase via Alexa in 2018. 🚀@PerspectiveIX via Recode. ❓Do you own a Smart Speaker, like Apple HomePod, Google Home, Amazon Echo, etc?

🦅 [ perspective ix ]

@perspectiveix · Post #1512 · 01.09.2018 г., 08:00

​​🗣The State of Chinese Voice Assistants China is the second-largest consumer market in the world, hitting $4.3T in consumer expenditure in 2016 alone (for reference, the US ranked first with $12.5T, and Japan third with $2.7T). The Chinese smart home market will reach nearly $23B in 2018, according to Juniper Research. #SmartSpeakers and #AI voice assistants are becoming an integral part of that. Now that smart speakers are becoming commonplace, the early entrant, #Amazon, is losing its market share — and not just to its rival #Google, but to newer players emerging in China. 🚀@PerspectiveIX via CBInsights. ❓ Do you own a smart speaker?