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

Резултати

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

Пребарај: #safepal

当前筛选 #safepal清除筛选

Tangem Core. Reliability. ❤️ ✅ Three similar devices offer a second and third chance to recover your assets in case of accidents or loss. ✅ The #Tangem chip is a product of a collaboration with Samsung Semiconductors, Inc. Its incredible performance and reliability. ✅ The chip is fortified against electromagnetic pulses (EMP), electrostatic discharge (ESD), and X-rays, adhering to the stringent ISO 7816-1 standard for security. ✅ The entire wallet is IP69K certified, offering full dust and water resistance. It functions optimally in temperatures between –25°C and +50°C. ✅Tangem devices have an impressive 25-year replacement warranty, reflecting our confidence in their longevity and durability. ✅ As a monolithic device, no components have a shorter lifespan or are vulnerable to damage or hacking. 🛡When it comes to safeguarding your assets, nothing is more crucial than unwavering reliability.🤜 🛍🛍Easy buy a cold wallet Tangem with a 10% discount promo code: FG7L9X at tangem.com #Safepal#Ledger#Trezor#TON

Tangem Core: Security❤️ What's inside? ✅Certified equipment: The highest level of safety among consumer devices — EAL 6+. ✅Firmware tested twice: First in 2018 by the Swiss company Kudelski Security and again in 2023 by the international laboratory Riscure. Both audits confirmed the absence of vulnerabilities and backdoors in the firmware, which cannot be updated. ✅Open Source Software: Fully transparent and available for review on GitHub. ✅Anti-counterfeit protection: When you activate your wallet, the app verifies the secure element, confirming its authenticity with #Tangem. ✅Private Key Security: Private keys are generated inside the chip when the wallet is activated using a hardware random number generator. No one, including Tangem, has access to these keys. ✅Smart Backup: Three hardware devices instead of one, each providing the same high level of security. No unsafe copies required. ✅Absolute privacy: Your private keys cannot be disclosed under any circumstances. ✅User-controlled access: The wallet is protected by your access code and biometric authentication. 🛡This is what absolute safety means! 🛍🛍Easy buy a cold wallet Tangem with a 10% discount promo code: FG7L9X attangem.com #Safepal#Ledger#Trezor#TON

OKX DEX — DEX aggregator and cross-chain bridge — now available on Tangem!⚪️ With a new provider — new opportunities: - Over 1,000,000 new exchange pair options. - Over 1,500 new tokens available for swap. - No KYC. The team is improving the versatility and usability of the Tangem app by integrating more and more providers. Update your app and start exchanging crypto right now!🔄 🛍 Buy a cold wallet #Tangem with a 10% discountfrom our channel using the promo code:FG7L9X #safepal#ledger#trezor#ton#okx

OKX DEX — DEX aggregator and cross-chain bridge — now available on Tangem Express!⚪️ With the new provider you can enjoy the following features: ↔️Over 1,000,000 new exchange pair options ↔️Over 1,500 new tokens available for swap ↔️KYC/AML not required🔥 Enjoy the ability to easily exchange crypto between different networks via the new OKX DEX directly in the Tangem app. Swap now! 🛍Buy a cold wallet #Tangem with a 10% discount from our channel using the promo code: FG7L9X #Safepal#Ledger#Trezor#TON#OKX#DEX

😇EVAA Updates: New Integrations, Expanded Features & Security Focus 🪙Integration with SafePal EVAA is now available in the TON DeFi Collection section of the SafePal wallet. Through #TON Connect, users can work with basic assets, take and issue loans, as well as use lending in various LP pairs. The team has prepared a detailed text guide on connecting and using the protocol. ☕️Partnership with Swap Coffee The protocol is integrated into the Swap Coffee aggregator. In the #Yield tab, you can now: • track the current APR for EVAA pools; • deposit and withdraw assets; • manage deposits and loans. 🪙Temporary suspension of collateral in $CATI Since Friday, July 11, support for the $CATI token in the ALTs pool has been temporarily disabled due to low liquidity. All active positions are safe and not subject to liquidation; however, opening new collateral in $CATI is currently not allowed. This decision was made to increase the protocol's stability. 🛡Trail of Bits audit completed EVAA successfully passed the final stage of the audit at Trail of Bits. Despite recent criticism of this company's address due to an incident with another project, the #EVAA team emphasizes that reliability and transparency remain its priority. EVAA app | News | Chat | Website #EVAA#SafePal#CATI#Audit#Security#DeFi#Toncoin