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

Резултати

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

Пребарај: #transfer

当前筛选 #transfer清除筛选
Libreware

@libreware · Post #1357 · 10.11.2024 г., 16:45

Warpinator for Android is an unofficial port of Linux Mint's file sharing tool of the same name. It is fully compatible with the original protocol and allows for easy transfer of files between Android and Linux devices. Features: - Automatic discovery of compatible services on local network - Works on WiFi or hotspot, no internet connection needed - Transfer any type of files quickly and easily - Receive entire directories - Run multiple transfers in parallel - Share files from other applications - Limit who can connect using a group code - Option to start on boot - Does not require your location or any other unnecessary permissions Android https://github.com/slowscript/warpinator-android https://f-droid.org/packages/slowscript.warpinator/ Linux https://github.com/linuxmint/warpinator Windows https://winpinator.swisz.cz https://github.com/slowscript/warpinator-windows #share#transfer

Libreware

@libreware · Post #1354 · 09.11.2024 г., 13:56

LocalSend free, open-source multiplatform app that allows you to securely share files and messages with nearby devices over your local network without needing an internet connection. https://github.com/localsend/localsend #share#transfer

Libreware

@libreware · Post #1353 · 09.11.2024 г., 13:04

FlyingCarpet Cross-platform AirDrop. File transfer between Android, iOS, Linux, macOS, and Windows over ad hoc WiFi. No network infrastructure required, just two devices with WiFi chips in close range. https://github.com/spieglt/FlyingCarpet #transfer#share

Libreware

@libreware · Post #1076 · 02.05.2022 г., 02:23

Sharik Share files across devices with Sharik! The app works with a Wi-Fi connection or a Wi-Fi Hotspot. No internet connection is needed. It is available for Android, iOS, Windows, Mac, and Linux. Download - https://github.com/marchellodev/sharik/releases Source - https://github.com/marchellodev/sharik/ @foss_Android #share#transfer

Libreware

@libreware · Post #961 · 30.06.2021 г., 11:55

Now KDE Connect can hook up your Windows machine as well! KDE Community @ https://www.twitter.com/kdecommunity/status/1409808049116700673/ The Windows version of KDE Connect gets official support and you can get the beta version right now from the Microsoft Store. Exclusive link-only access: https://microsoft.com/store/apps/9N93MRMSXBF0 https://kdeconnect.kde.org https://f-droid.org/repo/org.kde.kdeconnect_tp #kdeconnect#transfer#windows

Libreware

@libreware · Post #988 · 17.10.2021 г., 01:00

tFileTransporter Transfer apps, images and files to Android Devices and PCs Use UDP Broadcast or WiFi P2P create connections, Use TCP protocol to transfer files. This program builds with RxJava and Kotlin Coroutines. Android: https://github.com/Tans5/tFileTransporter F-droid (Izzy repo): https://f-droid.org/packages/com.tans.tfiletransporter/ Play Store: https://play.google.com/store/apps/details?id=com.tans.tfiletransporter Desktop: https://github.com/Tans5/tFileTransfer_desktop #tFileTransporter#transfer#share

纯情男高

@hanzichen · Post #1469 · 27.12.2025 г., 23:58

Warpdrop Warpdrop is a privacy-first, peer-to-peer file sharing tool that allows users to securely transfer files directly between terminals and browsers with ephemeral links, powerful NAT traversal, and complete self-hosting control. 🔗 Links: - Website - Features - Screenshots - Support group - Source code Developer: Mohd Zaid ❤️ Support the Project If this project makes your life easier, here are a few quick ways to show some love: ⭐ Star the repo/app ☕ Buy a coffee for the developer 🛠 Contribute code, issues, or pull-requests 🏷 Tags: #Website#P2P#Tools#Transfer

Libreware

@libreware · Post #1221 · 11.02.2024 г., 23:51

. KDE Connect is an app that makes it easy to connect your DeGoogled phone and/or Linux Phone to your Linux laptop using your phone's hot spot, or any network. KDE Connect can do these things: - Share files - Share clipboard - Control Slideshows w/phone - Send/Receive texts on laptop (Using KDE Connect Taskbar Indicator) - Control laptop media player - Move laptop mouse pointer 1. Install KDE Connect on phone Use KDEConnect on F-Droid 2. Install on laptop For Debian based distros: sudo apt install kdeconnect On your laptop firewall, make sure you open ports that KDE Connect uses. To do this, open up terminal and enter these commands: sudo ufw allow 1714:1764/udp sudo ufw allow 1714:1764/tcp sudo ufw reload 3. Connect both devices - Connect both to the same network - Open app on both devices - Find and pair devices ⚡️@LinuxTechIndex #KDEConnect#transfer#Files#share

Libreware

@libreware · Post #1003 · 27.10.2021 г., 01:09

Croc Easily and securely send things from one computer to another Features - allows any two computers to transfer data (using a relay) - provides end-to-end encryption (using PAKE) - enables easy cross-platform transfers (Windows, Linux, Mac, Android) - allows multiple file transfers - local server or port-forwarding not needed - ipv6-first with ipv4 fallback https://github.com/schollz/croc https://f-droid.org/en/packages/com.github.howeyc.crocgui/ 📡@NoGoolag📡@Libreware #croc#transfer#send#share

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