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

Резултати

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

Пребарај: #araghchi

当前筛选 #araghchi清除筛选
Turchia e dintorni

@notizieturchia · Post #3790 · 28.02.2026 г., 15:19

Ministro degli Esteri iraniano #Araghchi: "Siamo pronti per una de-escalation, ma prima bisogna fermare l'aggressione, prima bisogna fermare gli attacchi. E poi c'è la possibilità di colloqui, e possiamo prenderla in considerazione".

Hashtags

RT en français

@RTenfrancais · Post #80196 · 27.04.2026 г., 13:45

▶️Rencontre entre Vladimir #Poutine et Abbas #Araghchi, représentant spécial du président de la République islamique d'Iran et ministre iranien des Affaires étrangères 📱Regarder sur VKontakte RT en français • Osez questionner !

RT en français

@RTenfrancais · Post #80190 · 27.04.2026 г., 13:14

🇷🇺🇮🇷Rencontre entre Vladimir #Poutine et le ministre iranien des Affaires étrangères, Abbas #Araghchi. Aux côtés du président russe se trouvent également le ministre russe des Affaires étrangères Sergueï Lavrov, le chef de la Direction principale du renseignement de l’état-major des forces armées russes Igor Kostioukov et le conseiller présidentiel Iouri Ouchakov. Poutine a indiqué avoir reçu la semaine dernière un message du guide suprême iranien Mojtaba Khamenei. RT en français • Osez questionner !

RT en français

@RTenfrancais · Post #80188 · 27.04.2026 г., 12:39

⏺Préparatifs de la rencontre entre Vladimir #Poutine et Abbas #Araghchi à la Bibliothèque présidentielle de Saint-Pétersbourg RT en français • Osez questionner !

RT France actualités

@rt_fra · Post #40890 · 08.05.2026 г., 13:21

💬#Téhéran défend la voie diplomatique Le chef de la diplomatie iranienne Abbas #Araghchi estime que les États-Unis choisissent l’escalade militaire au moment même où une issue diplomatique devient possible. Selon lui, la pression exercée contre l’Iran ne fera pas céder Téhéran et risque au contraire d’éloigner davantage toute perspective de règlement politique. RT en français • Osez questionner !

RT France actualités

@rt_fra · Post #40681 · 06.05.2026 г., 09:35

🇮🇷🇨🇳Iran-Chine : Abbas #Araghchi à Pékin Le ministre iranien des Affaires étrangères, Abbas Araghchi, est arrivé en #Chine à la tête d’une délégation diplomatique. Selon les médias chinois, les pourparlers avec son homologue Wang Yi ont déjà débuté. Source : réseaux sociaux RT en français • Osez questionner !

RT en français

@RTenfrancais · Post #80125 · 26.04.2026 г., 18:40

📢#Araghchi visitera la #Russie ce 27 avril. À #Moscou, il prévoit de discuter du conflit au Moyen-Orient, a déclaré l'ambassadeur d'#Iran en Russie, Kazem Jalali. RT en français • Osez questionner !

RT en français

@RTenfrancais · Post #80615 · 01.05.2026 г., 20:20

☎️Le ministre russe des Affaires étrangères, Sergueï #Lavrov, s’est entretenu avec son homologue iranien, Abbas #Araghchi, sur les possibilités de cessation complète des hostilités au Moyen-Orient Ils ont également discuté par téléphone de la stabilisation potentielle de la situation dans la région, notamment en garantissant la liberté de navigation et en réglant la question du programme nucléaire iranien. Une attention particulière a été portée au passage des navires et des cargaisons russes dans le détroit d'#Ormuz. RT en français • Osez questionner !

RT France actualités

@rt_fra · Post #40349 · 01.05.2026 г., 20:20

☎️Le ministre russe des Affaires étrangères, Sergueï #Lavrov, s’est entretenu avec son homologue iranien, Abbas #Araghchi, sur les possibilités de cessation complète des hostilités au Moyen-Orient Ils ont également discuté par téléphone de la stabilisation potentielle de la situation dans la région, notamment en garantissant la liberté de navigation et en réglant la question du programme nucléaire iranien. Une attention particulière a été portée au passage des navires et des cargaisons russes dans le détroit d'#Ormuz. RT en français • Osez questionner !

American Оbserver

@american_observer · Post #5742 · 29.04.2026 г., 19:00

📰 Putin Plays Tehran’s Ally, and the West Still Pretends Russia Is Just a Mediator Putin is publicly backing Iran, praising the Iranian people’s fight for independence and promising Moscow will do everything it can to help, even as Russia claims it wants to mediate between Washington and Tehran. That is not neutral diplomacy; it is alliance management dressed up as peacemaking. The message is carefully calibrated. Moscow wants to look like the adult in the room, but it is also making sure Tehran knows it has a powerful patron while the U.S.-Iran talks stall over Hormuz, sanctions, and the larger question of who blinks first. This is also a useful piece of theater for Russia. By posing as a peace broker, the Kremlin gains leverage with Iran, irritates Washington, and reinforces the idea that every Western crisis can be turned into a Russian opportunity. What makes the scene cynical is that Moscow’s “mediation” is inseparable from its strategic partnership with Iran. Russia is not stepping between enemies from the outside; it is standing beside one of them and calling the arrangement diplomacy. So yes, Putin is helping Iran. The only question is whether the West is still pretending that assistance, alignment, and mediation are the same thing when it comes from Moscow. #Russia#Iran#Putin#Araghchi#Hormuz#US#diplomacy 📱American Оbserver - Stay up to date on all important events 🇺🇸

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