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

Резултати

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

Пребарај: #opensource

当前筛选 #opensource清除筛选
Linuxgram 🐧

@linuxgram · Post #18798 · 14.05.2026 г., 22:05

📰 BleachBit’s new TUI lets you clean without a desktop environment Open-source cleaning tool BleachBit has gained a text-based user interface (TUI) as an optional alternative to its standard graphical frontend. Unlike BleachBit’s existing CLI, which is intended for non-interactive use in scripts, the TUI is fully interactive, you navigate the interface with your keyboard (there’s limited mouse support) to select, preview and clean out cruft. 🔗 Source: https://www.omgubuntu.co.uk/2026/05/bleachbit-tui #opensource

Hashtags

Linuxgram 🐧

@linuxgram · Post #18795 · 14.05.2026 г., 19:31

📰 MuseScore Studio 4.7 Notation App Adds New Guitar Features MuseScore Studio 4.7 open-source notation app adds new engraving tools, guitar notation features, playback improvements, MP4 export, and more. 🔗 Source: https://linuxiac.com/musescore-studio-4-7-notation-app-adds-new-guitar-features/ #opensource

Hashtags

Linuxgram 🐧

@linuxgram · Post #18740 · 11.05.2026 г., 08:32

📰 Dusk is a reverse-engineered reimplementation of The Legend of Zelda: Twilight Princess The Legend of Zelda: Twilight Princess comes to PC thanks to a new open source reverse-engineered reimplementation called Dusk.Read the full article on GamingOnLinux. 🔗 Source: https://www.gamingonlinux.com/2026/05/dusk-is-a-reverse-engineered-reimplementation-of-the-legend-of-zelda-twilight-princess #opensource

Hashtags

Linuxgram 🐧

@linuxgram · Post #18739 · 11.05.2026 г., 08:06

📰 Restriced by the West, Huawei's Open Source HarmonyOS Now Powers 55 Million Devices It seems that Huawei has managed to create an ecosystem of hardware as well as software. 🔗 Source: https://feed.itsfoss.com/link/24361/17338103/harmony-os-rises-china #opensource

Hashtags

Linuxgram 🐧

@linuxgram · Post #18738 · 11.05.2026 г., 06:37

📰 Audacious 4.6 Media Player Promises File Browser Plugin, Beta Out Now Audacious 4.6 open-source media player is now available for public beta testing with a File Browser plugin, a macOS Now Playing plugin, support for playing Musepack SV8 files, and much more. 🔗 Source: https://9to5linux.com/audacious-4-6-media-player-promises-file-browser-plugin-beta-out-now #opensource

Hashtags

Linuxgram 🐧

@linuxgram · Post #18713 · 08.05.2026 г., 16:32

📰 Nintendo 64 emulator gopher64 adds controller hotkeys and auto-reconnect The free and open source Nintendo 64 emulator gopher64 has another useful new release out now, bringing a few more features to make it easier.Read the full article on GamingOnLinux. 🔗 Source: https://www.gamingonlinux.com/2026/05/nintendo-64-emulator-gopher64-adds-controller-hotkeys-and-auto-reconnect/ #opensource

Hashtags

Linuxgram 🐧

@linuxgram · Post #18695 · 07.05.2026 г., 07:22

📰vm2 Node.js Library Vulnerabilities Enable Sandbox Escape and Arbitrary Code Execution A dozen critical security vulnerabilities have been disclosed in the vm2 Node.js library that could be exploited by bad actors to break out of the sandbox and execute arbitrary code on susceptible systems.vm2 is an open-source library used to run untrusted JavaScript code inside a secure sandbox by intercepting and proxying JavaScript objects to prevent sandboxed code from accessing the host. 🔗 Source: https://thehackernews.com/2026/05/vm2-nodejs-library-vulnerabilities.html #opensource

Hashtags

Linuxgram 🐧

@linuxgram · Post #18693 · 06.05.2026 г., 20:34

📰Mesa 26.1 Released With Many Improvements For Open-Source Vulkan Drivers Eric Engestrom just announced another timely feature release of the Mesa drivers. Mesa 26.1 is out today for this collection of predominantly OpenGL and Vulkan drivers for a variety of hardware as well as the likes of Rusticl for OpenCL, Zink for OpenGL-on-Vulkan, various Windows acceleration components, and more... 🔗 Source: https://www.phoronix.com/news/Mesa-26.1-Released #opensource

Hashtags

Linuxgram 🐧

@linuxgram · Post #18692 · 06.05.2026 г., 17:58

📰 Inkscape 1.4.4 SVG Editor Released with a New Palette, Performance Improvements Inkscape 1.4.4 open-source SVG (Scalable Vector Graphics) editor is now available for download with a new palette, performance improvements,and bug fixes. Here’s what’s new! 🔗 Source: https://9to5linux.com/inkscape-1-4-4-svg-editor-released-with-a-new-palette-performance-improvements #opensource

Hashtags

Linuxgram 🐧

@linuxgram · Post #18674 · 05.05.2026 г., 03:41

📰 gThumb is barely recognisable in its GTK4/libadwaita port gThumb, the open-source image viewer and organiser, has been rewritten in Vala and ported to GTK4/libadwaita – and compared to the old UI, it’s barely recognisable. An alpha build of gThumb 4.0 is available for testing. Alongside the visual revamp, this brings support for WEBP and PNG animations, lets you export images in the JXL format and includes a censor filter to pixelate or blur out parts of an image. 🔗 Source: https://www.omgubuntu.co.uk/2026/05/gthumb-gtk4-port-redesign #opensource

Hashtags

Linuxgram 🐧

@linuxgram · Post #18669 · 04.05.2026 г., 17:17

📰 I tried an open-source Figma alternative, and its AI does what Figma's can't Not a Figma killer, but something more interesting. 🔗 Source: https://www.xda-developers.com/ditched-figma-for-open-source-tool-ai-does-what-figma-cant/ #opensource

Hashtags

Linuxgram 🐧

@linuxgram · Post #18663 · 03.05.2026 г., 22:06

📰 ReactOS Introduces Unified Live/Install Media, New Storage Driver ReactOS as the "open-source Windows" operating system project striving for binary compatibility with Microsoft Windows has seen some exciting improvements this week... 🔗 Source: https://www.phoronix.com/news/ReactOS-Unified-ISO #opensource

Hashtags

123•••10•••20•••30•••3738
ПретходнаСтраница 1 од 38Следна