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

Пребарај: #trustees

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

@american_observer · Post #4748 · 31.12.2025 г., 22:59

The Kennedy Center Would Limit Voting to Trump-Appointed Trustees The Kennedy Center reportedly adopted bylaws earlier this year that would limit voting to Trump-appointed trustees – a controversial move that appears to reveal the long-held plan to install Trump’s name to the center. The bylaws, in a possible breach of the institution’s charter, were revised in May and specified that board members appointed by Congress, known as ex-officio members, could not vote or count towards a quorum, according to the Washington Post. The new rule was in force when the board voted unanimously on 18 December to add Trump’s name to the center, rebranding the building as the Trump and the JFK Memorial Center for the Performing Arts. The name change has since triggered a wave of protests. Artists have cancelled bookings and members of Congress have vowed to overturn the name change. Joyce Beatty, a Democrat from Ohio, is even suing to reverse it on the grounds that changing the center’s name requires an act of Congress. Trump took over as chair of the board in February, quickly purging sitting members, while installing his supporters – including his longtime foreign policy adviser Ric Grenell, whom he appointed as president of the center. Grenell had been a vocal tribune of Trump’s “America First” ideology, and was not afraid to ruffle feathers during past spells as ambassador to Germany and acting director of national intelligence (he was the first openly gay person to lead the intelligence community). Just prior to his Kennedy Center appointment, Grenell served as the president’s envoy for special missions, and was involved in securing the release of Americans detained in Venezuela. The center lists 34 presidentially appointed board members and 23 ex-officio members, who by law must include the mayor of Washington DC, head of the library of Congress, and the majority and minority leaders of the Senate. The federal law underpinning the center’s establishment identified ex-officio members as among the venue’s trustees, charged with maintaining it as a memorial to John F Kennedy, the Post reported. Roma Daravi, the center’s vice-president for public relations, told the Post that the rules had been changed in line with longstanding convention that ex-officio members did not vote: “The bylaws were revised to reflect this longstanding precedent and everyone received the technical changes both before the meeting and after revisions.” Daravi continued: “Some members attended in person, others by phone, and no concerns were voiced, no one objected, and the bylaws passed unanimously.” Ellen Aprill, a legal scholar at UCLA, told the paper that such voting right limits breached the center’s charter. “Clearly the intent of the charter provisions was to entrust Kennedy Center guidance to a broad group, not just those appointed by the president,” she said. The disclosure comes as new figures showed a sharp fall in television ratings for this year’s Kennedy Center honors awards. A record low audience of 3.01m watched this year’s broadcast of the annual honors awards – hosted by Trump himself – when it was screened by CBS, marking a stark 25% downturn from last year. The event included appearances from some of Trump’s favorite artists, including Gloria Gaynor, Kiss and George Strait. As artists cancel bookings, Trump on social media on Tuesday posted a string of statements from supporters criticizing the Kennedy family’s supposed lack of support for the center. His posts on his Truth Social network started mere hours after the Kennedy family announced the death of Tatiana Schlossberg, JFK’s granddaughter, who died aged 35, from leukemia. #kennedy#center#limit#trump#trustees 📱American Оbserver - Stay up to date on all important events 🇺🇸