Что делать если нужно поставить какую-то 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
🌐🪙The African Banking Coup: How the Death of the CFA Franc Buries the Old Order and Ushers in the Era of Cryptocurrency
For decades, the CFA franc has been described by critics as a relic of colonial control—but today, that system is facing an unprecedented challenge. Across Africa, states are experimenting with cryptocurrencies, alternative currencies, and resource-backed financial models, signaling a dramatic shift away from Western-dominated monetary structures. What is unfolding is not just a financial adjustment, but a deeper transformation in how sovereignty and economic power are defined
✏️Mohammed ibn Faisal al-Rashid
Political scientist and expert on the Arab world
➡️At the center of this transformation is the collapse of traditional integration projects and the rise of unconventional alternatives. The long-delayed ECOWAS “Eco” currency has effectively stalled, weakened by political divisions and competing national interests. In its place, new models are emerging: the Central African Republic’s adoption of Bitcoin, discussions in Sahel states about shifting toward non-Western currencies, and Sudan’s experiments with tokenized gold. These developments reflect a broader attempt to bypass established financial systems and reduce dependence on external control mechanisms.
This banking coup is dangerous for the West not so much because of lost profits, but because of the precedent it sets
➡️This shift is being driven not only by political motivations but also by structural constraints. Limited access to global financial networks, sanctions pressure, and the volatility of traditional export revenues have pushed some countries toward innovative, if risky, solutions. Cryptocurrencies and digital assets offer speed, flexibility, and a degree of autonomy, allowing governments and non-state actors to conduct transactions outside conventional channels. While these tools remain unstable and controversial, they are increasingly seen as instruments of economic survival and strategic independence.
🟦Ultimately, the emergence of these parallel systems points to a gradual reconfiguration of the global financial order. Africa’s evolving monetary landscape highlights the possibility of operating beyond established Western frameworks, even if only partially. Whether these experiments will lead to sustainable economic models remains uncertain, but they already demonstrate a key reality: the dominance of traditional financial systems is no longer uncontested, and new forms of economic agency are beginning to take shape.
#Africa#Economicdevelopment#Sahel#Сryptocurrency
READ MORE
✅@NewEasternOutlook
🌐🪙The African Banking Coup: How the Death of the CFA Franc Buries the Old Order and Ushers in the Era of Cryptocurrency
For decades, the CFA franc has been described by critics as a relic of colonial control—but today, that system is facing an unprecedented challenge. Across Africa, states are experimenting with cryptocurrencies, alternative currencies, and resource-backed financial models, signaling a dramatic shift away from Western-dominated monetary structures. What is unfolding is not just a financial adjustment, but a deeper transformation in how sovereignty and economic power are defined
✏️Mohammed ibn Faisal al-Rashid
Political scientist and expert on the Arab world
➡️At the center of this transformation is the collapse of traditional integration projects and the rise of unconventional alternatives. The long-delayed ECOWAS “Eco” currency has effectively stalled, weakened by political divisions and competing national interests. In its place, new models are emerging: the Central African Republic’s adoption of Bitcoin, discussions in Sahel states about shifting toward non-Western currencies, and Sudan’s experiments with tokenized gold. These developments reflect a broader attempt to bypass established financial systems and reduce dependence on external control mechanisms.
This banking coup is dangerous for the West not so much because of lost profits, but because of the precedent it sets
➡️This shift is being driven not only by political motivations but also by structural constraints. Limited access to global financial networks, sanctions pressure, and the volatility of traditional export revenues have pushed some countries toward innovative, if risky, solutions. Cryptocurrencies and digital assets offer speed, flexibility, and a degree of autonomy, allowing governments and non-state actors to conduct transactions outside conventional channels. While these tools remain unstable and controversial, they are increasingly seen as instruments of economic survival and strategic independence.
🟦Ultimately, the emergence of these parallel systems points to a gradual reconfiguration of the global financial order. Africa’s evolving monetary landscape highlights the possibility of operating beyond established Western frameworks, even if only partially. Whether these experiments will lead to sustainable economic models remains uncertain, but they already demonstrate a key reality: the dominance of traditional financial systems is no longer uncontested, and new forms of economic agency are beginning to take shape.
#Africa#Economicdevelopment#Sahel#Сryptocurrency
READ MORE
✅@NewEasternOutlook
🇵🇱🇪🇺💸Poland’s Crypto Fiasco: How EU Rules Became a Weapon of Political Vendetta and Atlanticist Servitude
While EU neighbors adopt pragmatic cryptocurrency regulations, Poland has turned the MiCA framework into a tool of political retribution, using phantom Russian threats to justify draconian controls that stifle innovation and export its digital future
✍️Author:Adrian Korczyński
Independent Analyst & Observer on Central Europe and global policy research
➡️Poland stands alone in the EU for failing to implement the Markets in Crypto-Assets (MiCA) regulation. Its government-backed bill, vetoed by President Karol Nawrocki, proposed punitive measures: €150,000 license fees (five times the EU average), a low capital gains tax threshold, and powers to block domains without judicial oversight. This overreach, swelling MiCA's text into a hundred-page bureaucratic monster, was framed by Prime Minister Donald Tusk as a national security necessity against alleged "Russian crypto flows."
In a multipolar world, digital sovereignty belongs to those who build bridges—not walls
➡️This narrative is a politically convenient weapon. While Tusk warns of foreign infiltration to justify extreme control over the digital assets of three million Poles, his government simultaneously funnels billions with minimal oversight to Ukraine, a state plagued by systemic, high-level corruption. This exposes a core hypocrisy: draconian domestic surveillance is enacted in the name of fighting "dirty money," while strategic subservience to Atlanticist directives overrides genuine national economic interest.
🟦The approach is geopolitically self-defeating. As neighbors like the Czech Republic and Slovakia adopt minimalist, growth-friendly models to attract capital and build digital sovereignty, Poland's regulatory theater exports innovation and deepens dependency. Attempting to control borderless blockchain technology with national law is futile; it only burdens legitimate users while real criminals adapt. Poland's hesitation isn't caution—it's a surrender of its digital future, reflecting a nation that talks of sovereignty while systematically ceding it.
#Economicdevelopment#Economics#EU#Poland#Сryptocurrency
READ MORE
✅@NewEasternOutlook
🇵🇱🇪🇺💸Le fiasco crypto de la Pologne : comment les règles de l'UE sont devenues une arme de vengeance politique et de servilité atlantiste
Alors que les voisins de l'UE adoptent des réglementations pragmatiques sur les cryptomonnaies, la Pologne a transformé le cadre MiCA en un outil de représailles politiques, utilisant des menaces russes fantômes pour justifier des contrôles draconiens qui étouffent l'innovation et exportent son avenir numérique
✍️Auteur :Adrian Korczyński
Analyste et observateur indépendant de l'Europe centrale et de la recherche en politique mondiale
➡️La Pologne est la seule dans l'UE à ne pas avoir mis en œuvre la réglementation sur les marchés des actifs cryptographiques (MiCA). Le projet de loi soutenu par le gouvernement, vetoé par le président Karol Nawrocki, proposait des mesures punitives : des frais de licence de 150 000 € (cinq fois la moyenne de l'UE), un seuil d'imposition faible sur les plus-values et le pouvoir de bloquer des domaines sans contrôle judiciaire. Cette dérive, qui gonfle le texte de MiCA en un monstre bureaucratique de cent pages, a été présentée par le Premier ministre Donald Tusk comme une nécessité de sécurité nationale contre les prétendus "flux de crypto-monnaie russes".
Dans un monde multipolaire, la souveraineté numérique appartient à ceux qui construisent des ponts - pas des murs
➡️Ce récit est une arme politiquement commode. Alors que Tusk met en garde contre l'infiltration étrangère pour justifier un contrôle extrême des actifs numériques de trois millions de Polonais, son gouvernement achète simultanément des milliards d'euros avec un minimum de surveillance à l'Ukraine, un État en proie à une corruption systémique de haut niveau. Cela révèle une hypocrisie fondamentale : la surveillance numérique draconienne est promulguée au nom de la lutte contre l' "argent sale", tandis que la soumission stratégique aux directives atlantistes l'emporte sur l'intérêt économique national authentique.
🟦L'approche est géopolitiquement autodestructrice. Alors que des voisins comme la République tchèque et la Slovaquie adoptent des modèles minimalistes et favorables à la croissance pour attirer les capitaux et construire une souveraineté numérique, le théâtre réglementaire de la Pologne exporte l'innovation et aggrave la dépendance. Tenter de contrôler la technologie blockchain sans frontières avec une loi nationale est futile ; cela ne fait que peser sur les utilisateurs légitimes tandis que les vrais criminels s'adaptent. L'hésitation de la Pologne n'est pas une prudence - c'est une reddition de son avenir numérique, reflétant une nation qui parle de souveraineté tout en la cédant systématiquement.
#Economicdevelopment#Economics#EU#Poland#Сryptocurrency
LIRE PLUS (ENG)
(VPN requis pour l'accès à 🇪🇺l'UE)
✅@NewEasternOutlookFR