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

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #210 · 3 фев.

Что делать если нужно поставить какую-то Python-библиотеку а root-прав нет? То есть в систему библиотеку никак и ничего не поставить. Есть как минимум два способа это решить правильно! 🔸 Сделать виртуальное окружение и ставить там что угодно. Это позволит создать полностью независимое исполняемое окружение для ваших приложений. Все библиотеки будут храниться в домашней директории юзера а значит доступ на запись имеется. Создать очень просто: python3 -m venv ~/venvs/myenvname Теперь активируем окружение # Linux source ~/venvs/myenvname/bin/activate # Windows %userprofile%\venvs\myenvname\Scripts\activate.bat Можно ставить любые библиотеки и запускать приложение. Это стандартный метод работы с любым проектом. Если еще не используете его, то пора начинать. Даже при наличии root доступа! 🔸 Бывает, что нет возможности запустить приложение из своего виртуального окружения. Например, его запускает какой-то сервис от вашего юзера и вставить активацию окружения вы не можете. В этом случае можно установить библиотеки для Python не глобально в систему, а только для юзера. Выполните этот код в консоли: python3 -m site Вы получите что-то такое: sys.path = [ '/home/user', '/usr/lib/python37.zip', '/usr/lib/python3.7', '/usr/lib/python3.7/lib-dynload', '/home/user/.local/lib/python3.7/site-packages', ... ] USER_BASE: '/home/user/.local' USER_SITE: '/home/user/.local/lib/python3.7/site-packages' ENABLE_USER_SITE: True Нас интересует параметр USER_SITE. Это путь к пользовательским библиотекам, которые доступны по умолчанию, если они есть. Именно сюда будут устанавливаться модули если добавить флаг --user при установке чего-либо через pip pip install --user requests Для этой команды не нужны root-права. После неё можно запускать системный интерпретатор без виртуальных окружений и установленная библиотека будет доступна для текущего юзера. Параметр USER_BASE показывает корневую директорию для хранения user-библиотек. Её можно изменить с помощью переменной окружения PYTHONUSERBASE export PYTHONUSERBASE=~/pylibs python3 -m site ... USER_BASE: '/home/user/pylibs' USER_SITE: '/home/user/pylibs/lib/python3.7/site-packages' Получается некоторое подобие виртуального окружения для бедных 😁 которое можно менять через эту переменную (не делайте так!Лучше venv!) 🔸 Дописывание пути в PYTHONPATH Этот способ не входит в список "двух правильных", но тоже рабочий. Здесь придётся сделать всё несколько сложней. Сначала ставим библиотеку в любое место указывая путь установки pip3 install -t ~/mylibs modulename Библиотека установится без привязки к какому-либо интерпретатору. То есть по умолчанию не будет видна. Теперь в нужный момент добавляем этот путь в sys.path или в PYTHONPATH. Не буду советовать так делать. Единственный раз когда этот способ мне пригодился и решил поставленную задачу, это при создании общей библиотеки для кластера компьютеров. Модули лежат в сети и подгружаются для всех из одного и того же места. То есть обновлять файлы требуется только один раз а не на всех хосты отдельно. Минусы такого подхода: ▫️Нужно всем хостам пробить нужный путь в .bashrc или ещё куда-то чтобы он сетапился на старте. ▫️Чем больше хостов тем больше нагрузка на сеть. Иногда такой способ не подходит именно по этой причине. Тогда Ansible вам в помощь. ▫️Не очень подходит если хосты с разными операционками. Некоторые библиотеки различаются для Linux и Windows (там, где есть бинарники) и приходится мудрить более сложные схемы. #tricks#basic

Резултати

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

Пребарај: #techlaw

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

@ai_and_law · Post #793 · 26.03.2026 г., 08:04

🇺🇸White House Releases National AI Legislative Framework The White House published a national AI legislative framework aimed at centralizing regulation and preventing U.S. states from enacting their own AI laws. The initiative follows an executive order signed by President Donald Trump in December, which blocked state-level enforcement, and reflects a light-touch federal approach covering areas from data centers to AI-enabled scams. The framework outlines six objectives for Congress, including tools for parental control over children’s digital presence, streamlined permitting for data centers, and measures to address AI-related fraud. It also proposes balancing intellectual property rights with the need to train AI systems on real-world data and calls for limits on government influence over content moderation by technology providers. The administration emphasizes sector-specific regulation instead of a single rule-making authority and seeks to preempt state laws governing AI model development. According to White House officials, the framework is intended to support innovation while addressing safety risks associated with broader AI deployment. #AIRegulation#USpolicy#AIgovernance#TechLaw#ArtificialIntelligence

AI & Law

@ai_and_law · Post #763 · 12.02.2026 г., 08:04

🇪🇺📖ETSI Publishes Baseline AI Security Standards for Europe The European Telecommunications Standards Institute (ETSI) has released baseline cybersecurity standards for organizations implementing AI systems in Europe. The document sets out AI security expectations across the full lifecycle of AI tools, including design, deployment, and operational use. The standards were developed using guidance from the UK National Cyber Security Centre and the Department for Science, Innovation and Technology. They are intended to serve as a common security reference point for AI adoption, establishing minimum expectations for safeguarding AI systems against cyber risks. #AIRegulation#AIGovernance#Cybersecurity#AIStandards#ETSI#TechLaw

AI & Law

@ai_and_law · Post #783 · 12.03.2026 г., 07:04

🇺🇸Court Allows Enforcement of California AI Training Data Disclosure Law A US federal court has denied a request by Elon Musk’s AI company xAI to block enforcement of California Assembly Bill 2013. The law requires AI developers whose models are accessible in California to publicly disclose key information about training datasets, including dataset sources, collection timelines, whether collection is ongoing, and whether datasets contain copyrighted, trademarked, patented, or personal data. Companies must also indicate whether training data was licensed or purchased and the extent of synthetic data used. xAI argued the law would force disclosure of trade secrets, including dataset sources, dataset sizes, and data-cleaning methods. According to the company, such transparency could allow competitors to infer what datasets it uses and replicate its approach. The company warned that compliance could be “economically devastating” and reduce the value of its proprietary data practices. However, US District Judge Jesus Bernal ruled that xAI failed to demonstrate that the law requires disclosure of protected trade secrets. The court found the company’s claims too general and based largely on hypotheticals. The motion for a preliminary injunction was denied, allowing the law—which took effect in January—to remain in force while the lawsuit continues. #AIRegulation#AITransparency#TrainingData#TradeSecrets#AIAct#AIGovernance#TechLaw

AI & Law

@ai_and_law · Post #75 · 04.08.2023 г., 07:04

The Complexity of Regulating Foundation Models in the AI Act Hello, AI & Law community! Kai Zenner, the Head of Office and Digital Policy Adviser at the Office of MEP Axel Voss, shared his opinion on the OECD website about regulating foundation models in the AI Act. 🔹 The Existing Gap: The proposed AI Act by the European Commission, created before foundation models gained prominence in AI, doesn't explicitly cover these versatile models. Their potential for diverse, unforeseen purposes makes it tricky to fit them into the current product safety approach. The Act's use case approach, limiting AI systems to specific risk classes, is too inflexible for the latest foundation models that can handle various tasks. This creates a regulatory gap that needs to be addressed. 🔹 Positive Progress: The European Parliament has taken a proactive step to tackle this issue by introducing Article 28b, which adds a regulatory layer specifically for foundation models. This article outlines nine essential obligations for developers, including identifying risks, testing, evaluation, and thorough documentation. These measures aim to strike a balance between ensuring safety and fostering innovation in the AI landscape. 🔹 Targeted Approach: A crucial consideration is to avoid putting too much burden on smaller providers while still effectively regulating foundation models. Zenner proposes adopting a systemic approach, targeting only a small number of highly capable and relevant foundation models under the AI Act. This strategy could be similar to how Very Large Online Platforms are designated under the Digital Services Act, ensuring a balanced and efficient regulatory framework. #AIRegulation#FoundationModels#AIAct#AIInnovation#AICommunity#TechLaw#OECDInsights

Crypto M - Crypto News

@CryptoM · Post #64865 · 10.04.2026 г., 05:17

🚀 xAI Files Lawsuit to Block Colorado's Senate Bill 24-205 xAI has initiated legal action against the state of Colorado, filing a lawsuit in a U.S. district court on Thursday. According to NS3.AI, the company aims to prevent the enforcement of Senate Bill 24-205, which is set to take effect on June 30. xAI argues that the legislation would necessitate alterations to its Grok platform and impose requirements related to fairness and equity. #xAI#Colorado#SenateBill24205#Lawsuit#AIRegulation#Grok#TechLaw#Fairness#Equity