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

Резултати

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

Пребарај: #riyadh

当前筛选 #riyadh清除筛选
Addis Standard

@addisstandardeng · Post #21167 · 23.01.2026 г., 13:13

#UAE abruptly cuts aid to vital hospitals after withdrawing from #Yemen The sudden exit of the United Arab Emirates (UAE) from Yemen early this month came with a decision to end years of humanitarian support for key hospitals, abruptly cutting off access to specialised healthcare for many Yemenis. The UAE withdrew its forces after its separatist allies, the Southern Transitional Council, were routed in southern Yemen as #Riyadh sharply opposed the Emirati role in the #STC’s seizure of territory under the control of the Saudi-backed government. UAE-funded hospitals played a vital role for Yemenis after more than a decade of conflict had damaged public health infrastructure and left many unable to afford private healthcare. Patients from far and wide sought these these facilities in search of high-quality, free healthcare. Many undertake long journeys to access specialised surgeries... https://web.facebook.com/AddisstandardEng/posts/pfbid07VH6x99PAkGsbTnAkN2FrHgamxE1MamXC2iwAk5cbJWG28AQzAKzEzvqysmTuBfFl

Addis Standard

@addisstandardeng · Post #21402 · 14.02.2026 г., 07:12

News: #Eritrean president meets #Saudi deputy FM in Asmara following #Riyadh– #Addis diplomatic engagements President Isaias Afwerki of Eritrea held talks with Waleed bin Abdulkarim Al-Khereiji, Deputy Foreign Minister of Saudi Arabia, during a meeting in Asmara, according to Eritrea’s Ministry of Information. The meeting, held Thursday at the Denden Guest House, focused on strengthening longstanding bilateral relations and expanding cooperation across political, economic, security, cultural, and social sectors. The information ministry said discussions also covered shared perspectives on regional and international developments, including the role of Red Sea littoral states in maintaining regional peace and stability. Eritrea’s Foreign Minister Osman Saleh attended the talks alongside senior Saudi officials... https://www.facebook.com/share/1GDQjadMAW/

Addis Standard

@addisstandardeng · Post #21025 · 09.01.2026 г., 12:38

#Saudi_Arabia moves to rein in #UAE after Yemen exposes rivalry Saudi Arabia is moving to end the role of the United Arab Emirates in #Yemen and diminish its neighbor’s influence in other arenas, including the Red Sea, as tensions rise in the longstanding rivalry between the two Gulf powerhouses. After ordering the UAE to withdraw troops from Yemen and bombing a shipment of weapons it said Abu Dhabi was delivering to secessionists, #Riyadh is now looking to bring all UAE-backed factions in the deeply divided country under its control, according to two people briefed on the situation. The two OPEC+ members have jockeyed for influence in the war-torn, strategically located nation for years. The fallout between the #Arab world’s two biggest economies — and key American allies — will have repercussions far beyond Yemen. It could impact efforts to contain Iran and ensure the Gaza ...... https://web.facebook.com/AddisstandardEng/posts/pfbid02znoqYaEtyk1HsgV2jV9vdRBHHaCpT4SHqC4TrcpopGsqj4KupLe7ZnQRghdcsYvLl

Marwa Osman/MidEaStream

@Marwa_OsmanLB · Post #3965 · 04.02.2025 г., 04:38

Saudi Crown Prince Mohammed bin Salman received the appointed Syrian President Abu Mohamad al-Jawlani and his accompanying delegation upon his arrival at Al-Yamamah Palace in the Saudi capital, Riyadh. This was al-Jawlani’s first trip abroad since ousting the former regime. #Syria#SaudiArabia#Riyadh#MBS#AlJawlani

Addis Standard

@addisstandardeng · Post #21377 · 12.02.2026 г., 07:28

News: #Saudi Foreign Minister visits Addis Abeba a week after Gedion’s #Riyadh trip; talks focus on regional security and stability #Saudi_Arabia’s Minister of Foreign Affairs, Prince Faisal bin Farhan bin Abdullah, has arrived in #Addis_Abeba for an official visit, as #Ethiopia and Saudi Arabia step up diplomatic engagement centered on bilateral ties, regional security, and migration-related issues. According to a press release from Saudi Arabia’s Ministry of Foreign Affairs, the visit is aimed at discussing developments in the region and efforts to enhance regional security and stability. Prime Minister #Abiy Ahmed, who met with Prince Faisal, said he held “productive discussions on a broad range of bilateral and multilateral issues,” noting that talks focused on strengthening longstanding ties, expanding cooperation across key sectors, and enhancing coordination on regional and global matters of mutual interest........ Read more: https://addisstandard.com/?p=55154

Addis Standard

@addisstandardeng · Post #21034 · 10.01.2026 г., 09:29

#Yemeni southern separatists in #Riyadh announce disputed disbanding of #STC -The STC, which #SaudiArabia says is backed by the #UAE, launched an offensive against Yemeni gov’t troops in December. Yemen’s main southern separatists ‍have decided to disband following talks in Saudi Arabia, the secretary-general of the organisation has said, although the announcement was dismissed by its spokesman, who called it “ridiculous”. The Southern Transitional Council (STC) Secretary-General Abdulrahman Jalal al-Subaihi said in a broadcast on Yemeni television on Friday that the dissolution of the group was taken to preserve peace and security in the south and in neighbouring countries. He praised “the measures taken by the Kingdom of Saudi Arabia and the solutions it has provided that meet the needs of the people of the South”. https://www.aljazeera.com/news/2026/1/9/yemens-separatist-southern-transitional-council-announces-its-dissolution

Addis Standard

@addisstandardeng · Post #21858 · 27.03.2026 г., 08:01

News: #Saudi ‘freezes’ reported arms deal for #Sudan’s army, signals possible policy shift #Saudi_Arabia has reportedly frozen an arms deal intended to supply forces loyal to General Abdel Fattah #al-Burhan through #Pakistan, in what may signal a shift in #Riyadh’s approach to the ongoing conflict in Sudan. According to a report by Africa Intelligence, the move reflects growing skepticism within Saudi circles over al-Burhan’s reliability as a long-term partner, as the war continues and Sudan’s political and military landscape becomes increasingly fragmented. The report indicates that Riyadh may be recalibrating its position toward backing a political process aimed at establishing a civilian-led government, rather than pursuing military support that could further prolong the conflict. Read more: https://addisstandard.com/?p=56093

Marwa Osman/MidEaStream

@Marwa_OsmanLB · Post #4188 · 25.03.2025 г., 04:13

Lebanese daily @alakhbarnews reported that #SaudiArabia remains firm in its stance, maintaining economic pressure on #Lebanon. According to visitors to #Riyadh, the kingdom has conveyed that it will not contribute "a single penny" to Lebanon’s reconstruction efforts. Well-informed sources indicate that President #JosephAoun indirectly received this message during his meeting with Saudi Crown Prince #MohammedbinSalman earlier this month. Additionally, he was reportedly met with a firm Saudi refusal to lift the travel ban on its citizens visiting Beirut. During their discussions, bin Salman reportedly questioned Aoun on whether he could guarantee the safety of Saudi nationals traveling along Beirut’s airport road, which is lined with images of #Hezbollah and Iranian leaders. He remarked, “At the very least, remove the pictures.” Upon his return, Aoun relayed this request to Speaker of Parliament #NabihBerri, inquiring about the possibility of reducing the number of such images along the route. Why do you think Saudi Arabia cares about images displayed in another country? Share your thoughts with Hoopoe.

#SaudiArabia#Riyadh#desert#flood#weather#climate#destruction#anomaly#climatechange 🇸🇦Наводнение в пустыне после сильных дождей 🌧🌊🏜 28 марта 2026 года проливные дожди превратили пустынные районы вблизи Эр-Рияда (Саудовская Аравия) в бушующие потоки воды. Редкое явление: песчаные ландшафты были затоплены, а вода быстро распространилась по пустынной местности.