Что делать если нужно поставить какую-то 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
⚡️Рекордные
показатели в энергетике ⚡️
Великобритания вошла в историю: в 2024 году ветроэнергетика произвела
30% всего электричества страны – впервые став крупнейшим источником
энергии. A 18 декабря 2024 г. ветроэнергетика обеспечила
невероятные 68.3% электричества Британии – это новый рекорд!
Ветроэнергетика является краеугольным камнем цели нового правительства
Великобритании по полной декарбонизации энергопотребления в Великобритании к
2030 году, наряду с обязательством удвоить мощность наземной ветроэнергетики и
увеличить в 4x мощность морской ветроэнергетики к 2030 году.
#CleanEnergy#WindPower
🚨Переломный момент 🚨
Сегодня – Международный день чистой энергии. Знали ли вы, что
Великобритания достигла более 50% возобновляемой электроэнергии в течение
ЧЕТЫРЕХ кварталов подряд!
Еще впечатляющее: 58% электроэнергии Британии
поступило из чистых источников в 2024 году, а последняя угольная электростанция
навсегда закрылась в сентябре.
🌎Будущее – за возобновляемой энергией! 🌎
#CleanEnergy#SustainableFuture
👆स्वच्छ ऊर्जा से संचालित नया भारत।। 🇮🇳
पिछले 9 वर्षों में गैर-जीवाश्म स्रोत से उत्पादन बिजली क्षमता में उल्लेखनीय वृद्धि हुई है। भारत 2030 तक 50% गैर-जीवाश्म स्रोत से ऊर्जा उत्पादन करने की दिशा में निरन्तर प्रयासरत है।
#CleanEnergy
#NewIndia#Electricity
China Strengthens Its Position Amid Global Energy Crisis
China is better prepared for the global energy crisis thanks to vast oil reserves and advanced clean energy infrastructure. Beijing has boosted strategic reserves and invested heavily in solar, wind, and battery technologies, reducing risks from disruptions like those at the Strait of Hormuz. Coal remains vital, ensuring energy diversification. This crisis is set to further increase China’s influence in the global energy system.
#China#Energy#GlobalCrisis#CleanEnergy#Strategy
The main news of Russia and the world ishere.
InoBat Raises $103.62M
InoBat has successfully raised $103.62 million, marking a significant step forward in its mission to develop customized batteries aimed at promoting a sustainable future. The funding round took place on December 20, 2024. For more details, visit InoBat.
#InoBat#Funding#Batteries#Sustainability#CleanEnergy
🌞🇿🇦 South Africa’s Solar Breakthrough
In 2005, Prof. Vivian Alberts (pictured) of the University of Johannesburg developed a groundbreaking thin-film solar technology that could transform renewable energy.
Instead of thick, costly silicon panels, his design uses a metal-based semiconductor alloy only 3 microns thick (vs. ~300 microns for standard silicon panels) — dramatically reducing material costs.
Through his company PTiP (Photovoltaic Technology Intellectual Property), and in partnership with German engineering firm Singulus Technologies, a semi-commercial facility was launched in Stellenbosch to produce these next-gen panels.
🔋Why it matters:
⚡️ Far cheaper to manufacture
🌥 Generates power even in cloudy weather
🌍 A major step toward clean, affordable energy
#SouthAfrica#Innovation#Solar#RenewableEnergy#CleanEnergy#Sustainability
ZunRoof Secures $2.36M Funding
ZunRoof has raised $2.36 million in funding as of December 18, 2024. The company specializes in solar rooftop installation, promising a quick setup in just 9 days, allowing users to save money and switch to clean energy efficiently.
Learn more at ZunRoof.
#Funding#Solar#CleanEnergy#Rooftop#Installation#Sustainability#ZunRoof
Official Start of World Atomic Week
This event serves as a key platform for dialogue among the global nuclear industry leaders.
The ceremony was attended by officials from Russia and international organizations:
🔹 Sergey Kiriyenko, First Deputy Chief of Staff of the Presidential Executive Office, Chairman of the Rosatom Supervisory Council
🔹 Alexander Novak, Deputy Prime Minister of the Russian Federation
🔹 Rafael Mariano Grossi, Director General of the International Atomic Energy Agency (IAEA)
🔹 Sama Bilbao y León, Director General of the World Nuclear Association (WNA)
🔹 Alexey Likhachev, Director General of ROSATOM
Such high-level participation underscores the forum's exceptional importance for developing common approaches to the future of clean and safe nuclear energy.
#Rosatom#WorldAtomicWeek#NuclearEnergy#IAEA#WNA#Moscow#FutureOfEnergy#CleanEnergy
#Beijing_Review🇨🇳📕[PDF]⬇️
11 #December2025
#Weekly_Magazines
For learning, for free(dom).
@backupofmagazines
This issue centers on rule-of-law governance and China’s evolving development path, with the cover story tracing a shift from digital tools to people-centered justice under #RuleOfLaw and #Governance. Opinion pieces explore contemporary China through primary sources and pragmatic diplomacy, while features examine private investment, battery life-cycle management, and an emergency space launch highlighting #Innovation and #Technology. Energy ambitions take shape in the discussion of China’s “artificial sun,” reflecting long-term #CleanEnergy goals. Cultural and expat perspectives round out the issue, offering insight into heritage, youth exchange, and modernization in everyday China under #ChinaFocus and #GlobalDialogue.
#ClimateCrisis
🌍 The world is sinking into fossil fuels
Oil, gas, and coal account for 75% of global greenhouse gas emissions and nearly 90% of CO₂ emissions.
🔥 2024 became the hottest year in recorded history — global temperatures have risen 1.5°C above pre-industrial levels for the first time (according to @CopernicusClimate).
❄️ Consequences:
• Melting of polar ice caps
• Rising sea levels
• Intensifying storms and droughts
• Populations who contributed least to climate change are suffering the most
⛽️ Despite the crisis, consumption of oil, gas, and coal is increasing.
🌡 According to @UNEP, 2024 set a record for CO₂ emissions.
Many governments and corporations are promising “net zero,” yet in practice, fossil fuel extraction is being doubled.
🗣 “Governments are doubling fossil fuel extraction — this is double the risk for humanity and the planet,”
— said UN Secretary-General António Guterres.
📊 According to the @InfluenceMap report:
Just 57 corporations and state-owned companies were responsible for 80% of CO₂ emissions from fossil fuel and cement production between 2016 and 2022.
💡 The solution is a transition to clean energy and local resources.
But without transparency, investigative journalism, and public pressure, change will not happen.
🟢 Climate responsibility is not an abstract concept. It involves real names and real actions.
#EcoUz#ClimateCrisis#Copernicus#UNEP#CleanEnergy#ZeroEmission#StopFossilFuel#AralRegion#SustainableFuture
☘️Read the latest environmental news on the @ekologuz page. Follow us and send your suggestions and wishes via @eklguz_bot
Instagram | Facebook | Twitter | Sayt | Youtube.