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

Пребарај: #techregulation

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

@ai_and_law · Post #267 · 21.03.2024 г., 08:04

Civil Society Urges Action on EU AI Act Implementation In response to the recent vote on the AI Act, various civil society organizations, including Foxglove, ARTICLE 19, the Mozilla Foundation, and the Irish Council for Civil Liberties, have voiced their perspectives on the regulation. Emphasizing the urgency of the matter, they highlight the risks posed by the dominance of major tech corporations in the AI sector. These organizations underscore the importance of swift action to address unchecked corporate power, particularly in the realm of artificial intelligence. They advocate for robust enforcement of competition rules to safeguard democracy and public interests against potential threats arising from concentrated control within the tech industry. #AIAct#CivilSociety#TechRegulation

AI & Law

@ai_and_law · Post #742 · 14.01.2026 г., 08:04

🌐📖Responsible AI Governance in 2025: From Principles to Practice The Responsible AI Governance Network (RAGN) published "The 2025 Responsible AI Governance Landscape: From Principles to Practice" in December 2025. The report maps how AI governance evolved during 2025, highlighting five major shifts: the EU AI Act moving into enforcement, the coexistence of three non-converging governance models, the rise of board-level accountability, tensions between frontier and open-source AI, and courts increasingly shaping standards through litigation. The report includes sector-specific snapshots for healthcare, HR, finance, and public procurement, and examines the operational cost of AI governance, including staffing, tooling, and audits. It also provides a 30–60–90 day implementation roadmap with a maturity self-assessment designed for organizations deploying or overseeing AI systems. The publication documents concrete governance practices observed in 2025, such as cross-functional governance teams, continuously updated documentation, CI/CD-integrated controls, independent audits for high-risk systems, and ongoing monitoring instead of one-off assessments. It also identifies common implementation failures, including checkbox compliance, fragmented tooling, accumulated documentation debt, and governance processes that exist only formally. #AIandLaw#ResponsibleAI#AIGovernance#EUAIAct#AICompliance#TechRegulation

AI & Law

@ai_and_law · Post #452 · 27.11.2024 г., 08:04

Protecting Freedom of Expression within the AI Act Framework In a recent op-ed for Tech Policy Press, Jordi Calvet-Bademunt, Senior Research Fellow at The Future of Free Speech, delves into the AI Act’s potential impact on freedom of expression. With new requirements for assessing and mitigating systemic risks tied to high-impact AI, the Act aligns with the Digital Services Act (DSA) approach but introduces significant challenges. Providers of general-purpose AI now face complex responsibilities in balancing various fundamental rights. A misstep in judgment may lead to excessive content removal, as companies seek to avoid potential penalties—a trend that could inadvertently curb free speech, particularly for contentious viewpoints. As the European Commission prepares to enforce the Act, concerns are rising about the role of political influence in managing what constitutes "public security." Past examples, like then-Commissioner Breton’s statements advocating platform shutdowns during unrest, underline the risks associated with broad regulatory powers. The upcoming General-Purpose AI Code of Practice, set to accompany the Act, presents a vital opportunity for establishing protections that better secure freedom of expression. #AIGovernance#FreeSpeech#TechRegulation#AIAct#DigitalRights