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

Резултати

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

Пребарај: #azerbaijan

当前筛选 #azerbaijan清除筛选
肃反委员会

@KatyushaUnion · Post #7859 · 08.10.2023 г., 17:45

109 sq km of Azerbaijani territory is still under illegal occupation of Armenia. These are 7 villages (shown in the video) in the north and one village adjacent to Nakhchivan in the south. Armenia must return them to #Azerbaijan. https://twitter.com/NasimiAghayev/status/1710735177213763796

Hashtags

Voyage.Travel.Tourism

@VOYAGE · Post #1183 · 02.12.2024 г., 13:14

AZERBAIJAN 🇦🇿 Baku — the "Eastern Paris" on the shores of the Caspian Sea, the capital of Azerbaijan, an ancient city and a modern metropolis. Here, ancient alleys twist into labyrinths where the heroes of "Diamond Hand" once wandered. Elegant modern buildings with intricate balconies delight the eye, while mighty stone towers guard age-old secrets — and glass towers of skyscrapers gleam. Baku is as colorful as a masterpiece from the Carpet Museum and as cozy as a tea courtyard hidden in the depths of the Old City. #Azerbaijan @voyage

Hashtags

Voyage.Travel.Tourism

@VOYAGE · Post #1021 · 11.07.2024 г., 12:14

Azerbaijan 🇦🇿 Baku — the "Eastern Paris" on the shores of the Caspian Sea, the capital of Azerbaijan, an ancient city and a modern metropolis. Here, ancient alleys twist into labyrinths where the heroes of "Diamond Hand" once wandered. Elegant modern buildings with intricate balconies delight the eye, while mighty stone towers guard age-old secrets — and glass towers of skyscrapers gleam. Baku is as colorful as a masterpiece from the Carpet Museum and as cozy as a tea courtyard hidden in the depths of the Old City. #Azerbaijan @voyage

Hashtags

skhanzadeh.ir

@skhanzadeh_ir · Post #532 · 29.01.2023 г., 10:14

Azerbaijan's embassy gave illegal migration to the wife of an Iranian man. the man after months could not be patient. attacked the embassy with AK-47. the reaction of Azerbaijan's regime: 1. called this event a terrorist attack!!!! 2. wanna leave the embassy 3. will not say any response why they let the woman leaves Iran without permission when she was married and had 2 children. #Azerbaijan's regime is weird. @skhanzadeh_ir فناوری برای بشریت

Hashtags

ጠቅላይ ሚኒስትር ዐቢይ አሕመድ (ዶ/ር) በባኩ የክብር አደባባይ እና የድል ሀውልት የአበባ ጉንጉን አኖሩ ******* ጠቅላይ ሚኒስትር ዐቢይ አሕመድ (ዶ/ር) እና ቀዳማዊት እምቤት ዝንሽ ታያቸው በአዘርባጃን ባኩ በሚገኘው የክብር አደባባይ እና የድል ሀውልት የአበባ ጉንጉን የማስቀመጥ ሥነ ሥርዓት አከናውነዋል። ጠቅላይ ሚኒስትሩ በዚሁ ወቅት ባስተላለፉት መልዕክት፤ ሀውልቶቹ የሕዝቡን የማይበገር አንድነት የሚወክሉ መሆናቸውን ጠቁመዋል። ጠቅላይ ሚኒስትሩ ለአዘርባጃን አንድነት መስዋዕትነት ለከፈሉ ሁሉ ያላቸውን ጥልቅ ክብር ገልጸዋል። #EBC#Ethiopia#azerbaijan

Islamic World News

@iswnews_en · Post #16962 · 05.03.2026 г., 11:17

🇮🇷/🇦🇿🇮🇱✈️💥 Iran’s warning strike against Azerbaijan! ‼️ The armed forces of Iran reportedly targeted positions at the Nakhchivan International Airport in the Azerbaijan with a suicide drone. It appears that unusual activities linked to the Zionist regime have been observed in Azerbaijan, which may have prompted Iran to carry out this strike. 👉 However, some believe this attack could be a “false flag” operation intended to draw Baku into a confrontation with Iran. ✍️ Azerbaijan has for years been viewed as a base for the Zionist regime to conduct operations against Iran’s national security. This matter is not hidden, and security and military cooperation between Baku and Tel Aviv is taking place openly. #Iran#Azerbaijan

Islamic World News

@iswnews_en · Post #16881 · 04.03.2026 г., 10:19

🇮🇷/🇮🇱🇦🇿‼️It is said that the Iranian armed forces have attacked the assets of the Israeli regime inside the Republic of Azerbaijan. ✍️ For years, the Baku regime has turned its soil into a safe base for Israel, and the Israeli regime operates from there against the interests and national security of Iran. This time, no more! Iran is coming for you! #Iran#Azerbaijan

POPULAR FRONT

@popularxfront · Post #5282 · 06.03.2026 г., 11:08

🇮🇷#Iran - 🇦🇿#Azerbaijan: Emerging reports state that Azerbaijani troops have deployed artillery to the Iranian border to prepare for possible retaliatory attacks against the IRGC. (via @war_noir)

POPULAR FRONT

@popularxfront · Post #5274 · 05.03.2026 г., 10:08

🇮🇷#Iran – 🇦🇿#Azerbaijan: At least two Iranian drones struck Azerbaijani territory earlier today. According to Azerbaijani authorities, one Iranian drone, presumably launched by the IRGC, struck the terminal building of an airport in Nakhchivan, which can be seen in the footage. A second drone reportedly crashed near a school in the village of Shakarabad. Iran has not yet confirmed the attacks. Two people were injured as a result of the strikes. (via Reuters; 📹 via @war_noir)

Opportunities with Zula

@opportunities_zula · Post #979 · 11.01.2026 г., 08:05

International Youth Convention 2026 in Azerbaijan 🇦🇿 (Fully Funded) Apply: https://opportunitiescorners.com/international-youth-convention-in-azerbaijan/ Exceptional young Leaders from around the World are invited to apply. The program Covers Airfare, Meals, Accommodation. Deadline: 12 Jan 2026 #Azerbaijan#OpportunitiesCorners

Oğuz Eli

@oghuz_eli · Post #2168 · 05.03.2026 г., 23:16

Tehran molla rejimi dünən Naxçıvana PUA-ları atdı. Heç bir səbəbi olmadan əsassız yerə olan bir hücum. Srağagün Türkiyədə raketlə bir hücum olmuşdur. Mənə maraqlıdır ki, dırnaqarası "ağaya" yas saxlayanlar hansı bəhanə tapacaq? "İsrailin işi" mövzusu yalan və boş şeydir. Tək Tehran molla cumhuriyyətində olan PUA-ları İsrail ya Amerika necə ələ keçirə bilərdi? Həm də, molla rejimi hər dəfə Azərbaycana qarşı hücum eləməyə bəhanə axtarırdı. SEPAH-ın süni intellekt vasitəsi ilə düzələn qonşulara guya hədə-qorxu ilə gələn videoları yadınızdan çıxartdınız? Ya 2020-də Ermənistana hərbi yardımını? 2021-də Qarabağ hələ tam azad olunmayanda separatçılara yanacaq daşınan maşınlarını Azərbaycan Dövlət Sərhəd Xidmətinin qulluqçuları saxlayanda Azərbaycan sərhədlərinə yaxın öz ordularını təhdid üçün yeritməsini? Yoxsa 2023-cü ildə İranın dəstəyi ilə bir bişərəfin Azərbaycan səfirliyinə hücumunu? Ziya Bünyadovun satqın molla rejimin kölələri tərəfindən qətli və Fazil Mustafaya qarşı sui-qəsdi? Daha mən nəyi sizə deyim? Yoxsa siz "ağa" və "rəhbər" dediyiniz şəxsin Zəngəzur dəhlizinə qarşı olan mövqeyini bilmirsiz? Güneydə yaşayan soydaşlarımıza qarşı olan zülmdən xəbərsizsinizmi? Urmu gölünün qurumasından və molla rejimin bu məsələyə barmaqarası baxmasından xəbərsizsiniz? Yoxsa molla rejimin televiziya kanallarında və qazetlərində dilimizə "həşarat dili" və səfeh mollalar tərəfindən "türk dili cəhənnəmin dili" kimi ifadələrin deməsindən xəbərsizsiniz? Daha mən nəyi deyim? Cavab olaraq paylaşıma "ağamızın və İranın dini dəyərləri var" ifadəsini yazmayın. Ən azından dini dəyərləri olan ölkə Ramazan ayı vaxtı dinc dövlətə qarşı öz hücumlarını etmir və öz olkəsində bir şəxsin öz cinsini dəyişməyə icazəsini vermir. Bu paylaşımda İranın Azərbaycana qarşı yazdığım düşmənçilik siyasətin misallarından heç danışmıram. #Oğuz_Eli#Azerbaijan

123•••67
ПретходнаСтраница 1 од 7Следна