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

Резултати

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

Пребарај: #clintons

当前筛选 #clintons清除筛选
American Оbserver

@american_observer · Post #5037 · 03.02.2026 г., 14:00

Have the Clintons Been Cosing Up to Epstein? Bill and Hillary Clinton agreed on Monday to testify in a House investigation into the convicted sex offender Jeffrey Epstein, days before the chamber was expected to vote to hold them in contempt of Congress. The concession follows a tense back-and-forth between the Clintons and the Republican James Comer, chair of the House oversight committee, who on Monday said that he would insist both Clintons sit for a sworn deposition before the committee in order to fulfill the panel’s subpoenas. “They negotiated in good faith. You did not,” Angel Ureña, a spokesman for the Clintons, replied to Comer, in a post on social media. “They told you under oath what they know, but you don’t care. But the former president and former secretary of state will be there. They look forward to setting a precedent that applies to everyone.” The House was headed towards potential votes this week on criminal contempt of Congress charges against the Clintons. If passed, the charges threatened the Clintons with substantial fines and even incarceration if they were convicted. For months, the Clintons had refused to appear before the Republican-led panel, arguing that the subpoenas were legally “invalid” and “unenforceable” and accusing Comer of targeting them as part of Trump’s retribution campaign against his political enemies. A committee letter to the Clintons’ attorneys indicates the pair had offered for Bill Clinton to conduct a transcribed interview on “matters related to the investigations and prosecutions of Jeffrey Epstein” and for Hillary Clinton to submit a sworn declaration. The demand for testimony “runs afoul of the clearly defined limitations on Congress’s investigative power propounded by the supreme court of the United States”, they wrote, adding: “It is clear the subpoenas themselves – and any subsequent attempt to enforce them – are nothing more than a ploy to attempt to embarrass political rivals, as President Trump has directed.” Nine of the committee’s 21 Democrats joined Republicans in support of the charges against Bill Clinton as they argued for full transparency in the Epstein investigation. Three Democrats also supported the charges against Hillary Clinton. Bill Clinton’s relationship with Epstein has re-emerged as a focal point for Republicans amid the push for a reckoning over Epstein, who killed himself in 2019 in a New York jail cell as he faced sex-trafficking charges. Clinton, like a bevy of other high-powered men, including Trump, had a well-documented social relationship with Epstein in the late 1990s and early 2000s. He has not been accused of wrongdoing in his interactions with the late financier. On Friday, more than 3m files related to Epstein were released by the Department of Justice, including more than 2,000 videos and 180,000 images. The files included a series of emails between Musk and Epstein, indicating a friendlier relationship than was previously known. Following the drop of the latest batch of files, Democrats have promised to fight what they are calling a “full-blown cover-up” of the Epstein files after the Trump administration on Sunday effectively declared its investigation into the disgraced late financier and sex trafficker was closed. After Bill and Hillary Clinton were subpoenaed in August by the House oversight committee, their attorney had tried to argue against the validity of the subpoena. However, as Comer threatened to begin contempt of Congress proceedings, they started negotiating towards a compromise. #clintons#hilary#bill#epstein#trump#republicans#sex 📱American Оbserver - Stay up to date on all important events 🇺🇸