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

Резултати

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

Пребарај: #ailiteracy

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

@ai_and_law · Post #694 · 04.11.2025 г., 08:04

🇳🇱Netherlands' DPA Iissues Guide on Building AI Literacy The Netherlands' data protection authority, Autoriteit Persoonsgegevens, published guidance on developing AI literacy. The AP said AI literacy is critical for developing and deploying responsible AI and algorithms. The guide contains information on legal obligations and offers practical examples for implementing the AP's AI action plan, which is updated periodically. #AILiteracy

Hashtags

AI & Law

@ai_and_law · Post #581 · 30.05.2025 г., 07:04

🇪🇺AI Literacy Is Now a Legal Requirement in the EU: How it Works? As of February 2, 2025, Article 4 of the EU AI Act is in force—and with it, a new legal obligation: AI literacy is no longer optional. Providers and deployers of AI systems must ensure that their personnel, and anyone handling AI systems on their behalf, have sufficient understanding of how these systems function, what risks they carry, and how they interact with the people affected by them. The European AI Office has just released detailed Q&A guidance to clarify what this means in practice. It addresses the definition of “AI literacy,” how to assess adequate knowledge levels based on staff education, experience, and use context, and how enforcement will be handled. This is a significant compliance shift—especially for companies deploying AI in sensitive sectors. Training and governance functions will now need to be legally auditable. #AIAct#AILiteracy#AICompliance#AIGovernance

AI & Law

@ai_and_law · Post #768 · 19.02.2026 г., 08:04

🇺🇸U.S. Department of Labor Launches Federal AI Literacy Framework The U.S. Department of Labor has introduced the United States’ first federal-level AI literacy framework, a voluntary initiative aimed at guiding AI literacy programs across government, the public workforce, and education systems. The framework defines AI literacy as a foundational set of competencies enabling responsible use and evaluation of AI technologies, with a primary focus on generative AI as a core workplace tool. It is intended as a baseline understanding rather than specialized training for AI developers. Designed for broad application, the framework encourages tailored programs for different roles and contexts. It outlines benefits for workers (independent skill-building and adaptation to AI-enabled environments), employers (responsible deployment and workforce transition), and education providers (curriculum design and competency assessment). Although nonbinding, it is expected to influence private-sector training initiatives in the U.S. and abroad. The document emphasizes that AI literacy requirements will evolve with technological change, labor market developments, and implementation feedback. #AIRegulation#AILiteracy#GenerativeAI#PublicPolicy

AI & Law

@ai_and_law · Post #795 · 30.03.2026 г., 07:04

🇺🇸U.S. Department of Labor Launches “Make America AI-Ready” Initiative The U.S. Department of Labor announced the “Make America AI-Ready” initiative, a free AI literacy course designed to provide workers with foundational AI skills. The program delivers training via text messages, allowing users to complete the course in seven days with daily 10-minute sessions, aiming to ensure accessibility, including for individuals without reliable internet or devices. Developed in partnership with education technology company Arist, the initiative aligns with the White House’s AI Action Plan and America’s Talent Strategy. The course covers five areas: understanding AI principles, exploring use cases, directing AI through prompts, evaluating outputs, and responsible use. According to officials, the program is intended to prepare workers for an AI-driven economy and expand access to AI-related skills and opportunities. #AIRegulation#AILiteracy#FutureOfWork#USpolicy#AIgovernance