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

Резултати

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

Пребарај: #gatto

当前筛选 #gatto清除筛选
TONlines – News

@tonlines · Post #7346 · 23.05.2025 г., 14:36

Gatto Official Channel: Weekend Tournament and PvP Event #Gatto#TON Gatto is hosting a weekend tournament alongside a PvP event against its developers, launching on May 23. Players will have the chance to win various rewards by competing in both events, with the tournament ending on May 26 and the PvP event concluding on May 23. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #7213 · 14.05.2025 г., 14:31

Support Gatto in Telegram Apps Center Voting #Telegram#Gatto Gatto | Official Channel encourages users to vote for the Gatto app in the Telegram Apps Center. By participating, users can win Telegram Gifts or Telegram SBT and help raise their favorite app to the top. Source: link @tonlines

TONlines – News

@tonlines · Post #7429 · 29.05.2025 г., 09:23

⚡️Gatto Announces Temporary NFT Feature Downtime #NFT#Gatto Gatto | Official Channel (18+) informs users of a temporary halt to NFT functionality, citing ongoing technical resolutions which will last more than a day. Users are advised not to purchase Gattomon Eggs created between 5:00 p.m. and 6:30 p.m. UTC due to potential game recognition issues. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #7427 · 28.05.2025 г., 20:01

⚡️Gatto: NFT Minting Temporarily Unavailable #NFT#Gatto Gatto announces that NFT minting is currently on hold. Users are advised not to create NFT pets and eggs to avoid permanent loss. Updates will be shared once technical work concludes. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #7697 · 03.12.2025 г., 15:46

Gatto | Official Channel: Creative Contest Announcement #Gatto#GTON Gatto | Official Channel has announced a creative contest to celebrate a birthday, inviting talented individuals to participate by creating drawings, stories, and crafts dedicated to Gatto. Participants are categorized by age, with the chance to win $GTON rewards. Submissions are open until December 8th. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #6778 · 15.04.2025 г., 13:50

⚡️Gatto Official Channel: PvP Battle Event with Rewards #GTON#Gatto The Gatto Official Channel invites players to join a special PvP event starting at 14:00 UTC. Participants who defeat the GTeam in consecutive battles can earn various rewards, including Silver Coins, Legendary Gattoboxes, and more. The event takes place exclusively on the European server and runs until April 15, 15:00 UTC. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #7394 · 27.05.2025 г., 18:20

⚡️Gatto: Temporary Unavailability of the Game #Gatto#game The Gatto team has announced that the game is currently unavailable due to server issues. They are actively working to resolve the problems, and the game will be restored soon. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #7267 · 18.05.2025 г., 19:12

Gatto: Upcoming Technical Works Announced #Gatto#game Mr. Chipmunkus will be performing technical work on the Gatto game starting at 20:30 UTC. Although the game will remain accessible, players might encounter some bugs during this period. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #7118 · 08.05.2025 г., 19:37

Expand Your Play Area with Gatto Official Channel! #Gatto#game Gatto Official Channel introduces a new opportunity to expand the playing field from 40 to 42 squares by inviting friends. Players can unlock new plain and ice biomes with eggs after their friends complete training by Sage Moc. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #6987 · 30.04.2025 г., 14:43

Technical Update at Gatto | Official Channel #Gatto#game Gatto | Official Channel has scheduled technical work with Mr. Chipmunkus. Players may experience some bugs until the game operations return to normal. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #6955 · 29.04.2025 г., 08:12

Gatto: Ongoing Technical Works #Gatto#game Gatto is undergoing technical maintenance by Mr. Chipmunkus. Though the game remains accessible, players might encounter some bugs until everything is fully restored. Source: link @tonlines

Hashtags

TONlines – News

@tonlines · Post #6925 · 24.04.2025 г., 12:42

⚡️Gatto: Temporary Downtime for Technical Maintenance #Gatto#game Gatto | Official Channel announces upcoming technical maintenance by Mr. Chipmunkus after mine completion. The game will be unavailable today from 13:00 UTC. Source: link @tonlines

Hashtags

ПретходнаСтраница 1 од 4Следна