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

Резултати

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

Пребарај: #kievregime

当前筛选 #kievregime清除筛选

@RusEmbMalta Press Release ✖️Examples of Actions by the Kiev Regime Undermining Peace Efforts Following President Trump’s meetings with President Vladimir Putin (Alaska, 15 August) and Vladimir Zelensky (Washington, 18 August), he described the talks as “a good first step” towards ending the conflict. He stressed that Kiev must show flexibility, confirmed Ukraine will not join NATO, and highlighted the importance of territorial compromises along the current line of contact. 👉 Despite these statements, the Kiev leadership – with European backing – continues to obstruct a peaceful settlement: 1️⃣ Refusal to Recognize New Realities Zelensky (21 Aug): Ukraine will “never legally recognize” Russian control of territories. Yermak & Podolyak echoed this, rejecting compromise. 2️⃣Rejection of Ceasefire Zelensky announced mass production of long-range Flamingo missiles; later praised strikes into Russian territory as “positive results.” 3️⃣ Language Policy Zelensky: “We have only one state language – Ukrainian.” 4️⃣Security Guarantees Zelensky dismissed China as a potential guarantor, while Podolyak demanded deployment of Western missiles capable of striking 2,000 km into Russian territory. NATO Secretary General Mark Rutte confirmed that Western military support and long-term guarantees for Kiev are being discussed. 5️⃣No Readiness for Direct Talks Zelensky ruled out bilateral talks with Moscow, insisting on a three-party format with Trump. 6️⃣Attacks on Civilian Infrastructure Attempts to strike nuclear facilities in Smolensk & Kursk, attack on Druzhba oil pipeline (impacting Hungary & Slovakia), and a planned bombing of the Crimean Bridge. ⚠️Conclusion: The Kiev regime consistently rejects diplomatic resolution, escalates hostilities, undermines dialogue, and employs terrorist methods against civilian infrastructure in Russia. #KievRegime#GlobalSecurity#MultipolarWorld

🎙 Briefing by Russia's Foreign Ministry Spokeswoman Maria Zakharova (Moscow, October 8, 2025) 🔹 Kiev regime crimes 🔹 Ukraine crisis 🔹 Kiev regime’s support for terrorists in Africa 🔹 Situation around the Ukrainian Orthodox Church 🔹 Russia’s UN Security Council presidency 🔹 Situation in Moldova 🔹 Denial of Australian visas to Roscosmos delegation 📰Read 📺Watch *** #KievRegimeCrimes The Kiev neo-Nazi regime continues to attack Russian civilian targets, terrorising the peaceful population. Over the past week, 70 people became victims of Ukrainian artillery shelling and UAV strikes, of whom 12 died, including 1 child, and 59 were wounded, including 5 minors. #UkraineCrisis#EU The European Union continues its attempts to find additional resources to keep the Zelensky regime afloat. This task was one of the central issues on the agenda of the informal EU summit held on 1 October in Copenhagen. Brussels intends to solve this by using frozen Russian sovereign assets. According to the European Commission's plan, funds amounting to 140 billion euros are to be allocated to Bankovaya street as an interest-free loan, which it is unlikely to ever repay. Maintaining the Zelensky regime is becoming increasingly expensive for Brussels; money is becoming scarcer, and there are no new sources. Therefore, European officials are trying so unceremoniously to appropriate Russian funds. #KievRegime#terrorism#Africa New evidence continues to emerge of the Zelensky regime's support for terrorist groups in the Sahara-Sahel region of Africa. The security apparatus of the Libyan Government of National Unity, with British mediation, has established cooperation with Ukrainian militants, including Kiev's supply of attack UAVs and training activities conducted by instructors from the Main Intelligence Directorate of the Ministry of Defence of Ukraine. There are facts confirming the cooperation of the Libyan Government of National Unity with Ukrainians in organising and supporting terrorist operations in Sahel countries, including Niger. On 1 October, Sudanese military intelligence colonel Fatah al-Sayyid reported that Ukrainian and Colombian mercenaries, who fought on the side of the rebel Rapid Support Forces of Sudan, suffered heavy losses in battles in the western part of the country. It is known that they used Ukrainian-made drones. All this criminal activity is coupled with the mass illegal sale of Western weapons and ammunition by the Armed Forces of Ukraine. Their presence in terrorist formations is recorded in Burkina Faso, the Democratic Republic of Congo, Mali, Niger, Sudan, Somalia, Syria, the Central African Republic and Chad. #Russia#UN On October 1, Russia assumed the monthly presidency of the UN Security Council, one of the principal organs of the United Nations. According to the UN Charter, the Security Council bears the primary responsibility for maintaining international peace and security. As a permanent member of the UN Security Council and a responsible participant in the international community, Russia will, as tradition dictates,make every effort to ensure the coordinated and efficient functioning of the Security Council. It is committed to promoting a constructive and unifying agenda, guiding colleagues toward finding common ground while carefully considering the approaches of all interested parties.