Что делать если нужно поставить какую-то 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
🧪 An Experiment Is LIVE!
We just rolled out major changes to how combination scores work — and the Forge feels very different now.
🔵 Some combinations now grant massive Mult & Gen
🔵 Several Jokers have been rebalanced to match the new system
🔵 Expect fresh strategies, new meta shifts, and plenty of surprises
Jump in, test everything & tell us what you think —
this experiment will help us shape the final global balance before launch.
➡️DeckForge - Play Now!
Stay Forged! 🔥
#DeckForge#FromTheForge#OpenBeta
Join the DeckForge Community:
🌐YouTube𝕏Twitter🎮Discord
👉Chat👉Announcements👉DeckForge
🛡️ ANTIFRAUD is LIVE — The Forge Stands Protected
Over 3,000+ runs have already been played in the Open Beta — and now it’s time to level up the battlefield.
To protect fair competition and keep the economy stable, we’ve officially added the ANTIFRAUD system to the game.
Every run, every reward, every trade — now safeguarded!
🔥 This Week in DeckForge
🔵 New Challenges Added
Daily Runs will now feature unique in-game objectives
🔵 Loyalty Rewards Incoming
All resources earned during Closed & Open Beta have been tracked.
They’ll be converted into a new currency: Loyalty
You’ll soon be able to spend it in a special shop for exclusive items
🔵 New Jokers & Balance Update
Fresh cards are entering the meta + gameplay balance improvements based on your feedback
We’re building this world together — your progress, your feedback, your victories shape the Forge.
Thank you for being here.
Stay Forged! 🔥
#DeckForge#FromTheForge#OpenBeta
Join the DeckForge Community:
🌐YouTube𝕏Twitter🎮Discord
👉Chat👉Announcements👉DeckForge
🔥 DeckForge Official Website is LIVE!
Our official website is now online — the first step toward building a full digital home for the entire DeckForge community.
👉https://play.deckforge.net/
Over the coming weeks, we’ll be expanding it with new sections, guides, lore, developer updates, partner announcements & exclusive content that will grow together with the game and our universe.
More updates are coming. Stay Forged!
#DeckForge#Website#OpenBeta
Join the DeckForge Community:
🌐YouTube𝕏Twitter🎮Discord
👉Chat👉Announcements👉DeckForge
OnePlus 8 Oxygen OS Open Beta 10
System
• Improved the loading speed of the Privacy Policy page
• Improved the text display of the Setup Wizard
• Improved the audio quality recorded with headphones
• Fixed the abnormal display issue with the Setting when the Freeform Windows is enabled
• Fixed the occasional issue that the status bar displays two SIM cards' mobile data icons
• Fixed the occasional issue that the lockscreen widget still exists even music notification is removed
• Updated Android security patch to 2021.05
Ambient Display
• Newly added Bitmoji AOD, co-designed by Snapchat & Bitmoji, which will liven up the ambient display with your personal Bitmoji avatar. Your avatar will update throughout the day based on your activity and things happening around you ( Path: Settings - Customization - Clock on ambient display - Bitmoji )
Phone
• Improved the audio experience when the phone is connected with OnePlus Watch and OnePlus Buds
• Fixed the issue that the call recording list is not updated in time after the system is upgraded
• Fixed the occasional issue that personal contact card cannot be displayed
• Fixed the issue that the calling page is not displayed during a call
Camera
• Improved the video preview clarity under 4K 60FPS mode
Bluetooth
• Improved the connection to OnePlus Buds
Network
• Fixed the occasional issue that the non-default data SIM card in gaming mode can't get access to 4G network
• Fixed the issue that the nearby Wi-Fi network cannot be intelligently switched intelligently
• Fixed the occasional Wi-Fi connection failure
MD5
Full:
392227d0f6b7d29dc56bfcb3d30e4728
Size
Full:
2.89 GB (3103064264)
Downloads
Oxygen OS Server:
Full
Color OS Server:
Full
Exported by MlgmXyysd Color OTA Bot@OnePlusOTA
#Oxygen#instantnoodle#OpenBeta#Full
OnePlus 8 Oxygen OS Open Beta 7
System
• Adjusted the layout of the emergency rescue in the password lock screen
• Fixed the issue that the Horizon light has a small probability of failing to turn on
• Updated Android Security Patch to 2021.02
Camera
• Optimized the stability
MD5
Full:
237c0c620471f50d43328c1b067658cb
Size
Full:
2.85 GB (3054822978)
Downloads
Oxygen OS Server:
Full
Color OS Server:
Full
Exported by MlgmXyysd Color OTA Bot@OnePlusOTA
#Oxygen#instantnoodle#OpenBeta#Full
OnePlus 8 Oxygen OS Open Beta 6
System
• Optimized the UI display of the status bar
• Optimized the stability of frame rate and improved the experience when playing games
• Optimized the interface of the Community homepage and make notifications more eye-catching
• Fixed the crash issue where the drop-down menu of Browser
• Updated Android Security Patch to 2021.01
Shelf
• Newly added Dock, a dashboard that displays various information, including daily steps, screen usage time, etc.
• Optimized weather animation effects to improve fluency
Weather
• Optimized animations for sunny and cloudy days for a clearer dynamic display
Gaming Space
• Fixed the issue where notifications could not be turned off in the game in some cases
Gallery
• Optimized the layout of the cloud service interface in the Gallery for a better operation experience
Bluetooth
• Improved the transmission rate of Bluetooth when connecting watches
MD5
Full:
d97271f22aa23933279239e6f4b96593
Size
Full:
2.84 GB (3054425866)
Downloads
Oxygen OS Server:
Full
Exported by MlgmXyysd Color OTA Bot@OnePlusOTA
#Oxygen#instantnoodle#OpenBeta#Full
OnePlus 8 Pro Oxygen OS Open Beta 10
System
• Improved the loading speed of the Privacy Policy page
• Improved the text display of the Setup Wizard
• Improved the audio quality recorded with headphones
• Fixed the abnormal display issue with the Setting when the Freeform Windows is enabled
• Fixed the occasional issue that the status bar displays two SIM cards' mobile data icons
• Fixed the occasional issue that the lockscreen widget still exists even music notification is removed
• Updated Android security patch to 2021.05
Ambient Display
• Newly added Bitmoji AOD, co-designed by Snapchat & Bitmoji, which will liven up the ambient display with your personal Bitmoji avatar. Your avatar will update throughout the day based on your activity and things happening around you ( Path: Settings - Customization - Clock on ambient display - Bitmoji )
Phone
• Improved the audio experience when the phone is connected with OnePlus Watch and OnePlus Buds
• Fixed the issue that the call recording list is not updated in time after the system is upgraded
• Fixed the occasional issue that personal contact card cannot be displayed
• Fixed the issue that the calling page is not displayed during a call
Camera
• Improved the video preview clarity under 4K 60FPS mode
Bluetooth
• Improved the connection to OnePlus Buds
Network
• Fixed the occasional issue that the non-default data SIM card in gaming mode can't get access to 4G network
• Fixed the issue that the nearby Wi-Fi network cannot be intelligently switched intelligently
• Fixed the occasional Wi-Fi connection failure
MD5
Full:
2d05d2f58c8e04951a6b1c1f681ce7a9
Size
Full:
2.94 GB (3161792182)
Downloads
Oxygen OS Server:
Full
Color OS Server:
Full
Exported by MlgmXyysd Color OTA Bot@OnePlusOTA
#Oxygen#instantnoodlep#OpenBeta#Full
OnePlus 8 Pro Oxygen OS Open Beta 7
System
• Adjusted the layout of the emergency rescue in the password lock screen
• Fixed the issue that the Horizon light has a small probability of failing to turn on
• Updated Android Security Patch to 2021.02
Camera
• Optimized the stability
MD5
Full:
47eadba5de4c73c4b57506227ac3e766
Size
Full:
2.90 GB (3112977371)
Downloads
Oxygen OS Server:
Full
Color OS Server:
Full
Exported by MlgmXyysd Color OTA Bot@OnePlusOTA
#Oxygen#instantnoodlep#OpenBeta#Full
OnePlus 8 Pro Oxygen OS Open Beta 6
System
• Optimized the UI display of the status bar
• Optimized the stability of frame rate and improved the experience when playing games
• Optimized the interface of the Community homepage and make notifications more eye-catching
• Fixed the crash issue where the drop-down menu of Browser
• Updated Android Security Patch to 2021.01
Shelf
• Newly added Dock, a dashboard that displays various information, including daily steps, screen usage time, etc.
• Optimized weather animation effects to improve fluency
Weather
• Optimized animations for sunny and cloudy days for a clearer dynamic display
Gaming Space
• Fixed the issue where notifications could not be turned off in the game in some cases
Gallery
• Optimized the layout of the cloud service interface in the Gallery for a better operation experience
Bluetooth
• Improved the transmission rate of Bluetooth when connecting watches
MD5
Full:
82612835d791cf69c1180b6e61acc338
Size
Full:
2.90 GB (3113213478)
Downloads
Oxygen OS Server:
Full
Exported by MlgmXyysd Color OTA Bot@OnePlusOTA
#Oxygen#instantnoodlep#OpenBeta#Full
OnePlus 7T Pro Oxygen OS Open Beta 4
System
• Fixed the issue that the battery icon in the status bar is abnormally displayed
• Fixed known issues and improved system stability
Bluetooth
• Fixed the issue where Bluetooth headsets are silent in aptX Adaptive mode
MD5
Full:
4b620a1c6dbf43c0821801ae30578aaa
Size
Full:
2.54 GB (2722006826)
Downloads
Oxygen OS Server:
Full
Color OS Server:
Full
Exported by MlgmXyysd Color OTA Bot@OnePlusOTA
#Oxygen#hotdog#OpenBeta#Full
OnePlus 7T Pro Oxygen OS Open Beta 3
System
• Optimized the effect of unlocking animation
• Fixed the issue of slow charging rate in some cases
• Fixed the lagging issue when playing screen-recorded videos
• Fixed the small probability failure issue with the Double Tap to Wake
Bluetooth
• Fixed the silent issue when the Bluetooth transport protocol is changed to AptX
Network
• Improved the stability of the Wi-Fi connection and reduce Internet outages
MD5
Full:
c9cf20be4a8c1e779274077939d1f26f
Size
Full:
2.54 GB (2728165938)
Downloads
Oxygen OS Server:
Full
Color OS Server:
Full
Exported by MlgmXyysd Color OTA Bot@OnePlusOTA
#Oxygen#hotdog#OpenBeta#Full
OnePlus 7T Pro Oxygen OS Open Beta 2
System
• Optimized the sliding effect of the dynamic wallpaper
• Improved power consumption in some scenarios
• Optimized the adjusting intensity of automatic brightness to bring a more smooth using experience
• Fixed the issue with the adapter not charging and using the headset at the same time
• Fixed the issue in which the battery icon is not displayed on the status bar
• Fixed the issue that 'Tips & Support' is not displayed in the Settings
Camera
• Fixed the small probability flashback issue with the camera when unlocking in professional mode
Ambient Display
• Newly support Always-on ambient display feature for OP7Pro and OP7TPro (Go to: Settings - Utilities - OnePlus Laboratory - Always-on ambient display)
MD5
Full:
eadfb6afc0b71c22f54da05d06761992
Size
Full:
2.54 GB (2730220320)
Downloads
Oxygen OS Server:
Full
Color OS Server:
Full
Exported by MlgmXyysd Color OTA Bot@OnePlusOTA
#Oxygen#hotdog#OpenBeta#Full