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

Пребарај: #spainai

当前筛选 #spainai清除筛选
AI & Law

@ai_and_law · Post #164 · 14.11.2023 г., 08:04

Spain's AI Minister Calms Startups Amid AI Act Concerns Hello, everyone! Spain's AI and Digitalisation Minister, Carme Artigas, urges calm among AI startup founders regarding the AI Act. She assures that the Act's aim is to foster innovation, offering a two-year adaptation period and national sandbox initiatives to support companies. The legislation has undergone three years of extensive contemplation to ensure it remains adaptable amidst AI's rapid advancements. Despite challenges, Artigas is confident about reaching an agreement on the legislation by year-end. #SpainAI#AIAct#Innovation#AIPolicy

AI & Law

@ai_and_law · Post #104 · 05.09.2023 г., 07:04

New AI Regulatory Body Established in Spain Hello, everyone! Spain has taken a pioneering step in the European Union by creating a dedicated authority for the regulation of artificial intelligence. The Spanish Agency for the Supervision of Artificial Intelligence (AESIA) has been officially established through a Royal Decree and confirmed by the Council of Ministers on August 22. The institution aims to ensure that AI development in Spain aligns with inclusivity, sustainability, and the welfare of its citizens. It will oversee the National Artificial Intelligence Strategy, positioning Spain as a frontrunner in AI innovation. This move is part of Spain's Digital Spain 2025 Agenda, a €600 million initiative encompassing over 50 measures to shape the nation's digital future. AESIA is also expected to enforce the EU's landmark AI Act, putting Spain at the forefront of responsible AI regulation in Europe. #AIRegulation#SpainAI#DigitalEurope#Innovation#AESIA