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

Резултати

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

Пребарај: #empowerment

当前筛选 #empowerment清除筛选
EUROUZ 🇪🇺 🇺🇿 News

@eurouz_official · Post #360 · 08.03.2024 г., 12:21

[UZ] Bugun biz Xalqaro xotin-qizlar kunini butun dunyo ayollarining ajoyib yutuqlari va hissalarini keng qo’lamda nishonlaymiz. Keling, gender tengligini qo'llab-quvvatlashga, bir-birimizni kuchaytirishga va to'siqlarni birgalikda yengishga va'da beraylik. Va yana bir bor bu go’zallik bayrami bilan ayyolarimizni chin qalbdan tabriklaymiz - [EN] Today, we celebrate International Women's Day by honoring the incredible achievements and contributions of women around the globe. Let's pledge to support gender equality, empower each other, and break barriers together. Every step forward makes a difference. - [RU] Сегодня мы отмечаем Международный женский день, отмечая невероятные достижения и вклад женщин во всем мире. Давайте пообещаем поддерживать гендерное равенство, расширять возможности друг друга и вместе преодолевать трудности. Каждый шаг вперед имеет значение. #InternationalWomensDay#Empowerment Follow EUROUZ on Telegram: @eurouz_official Web | Instagram | Facebook| Twitter (X) |LinkedIn

शिक्षा, कौशल विकास और उद्यमिता में भारी निवेश कर प्रधानमंत्री के नेतृत्व में केन्द्र सरकार #NorthEast के जनसामान्य का सशक्तिकरण कर रही है। #YuvaShakti#Empowerment#YuvaShaktiForNE

BadVolf

@BadvolfNews · Post #760 · 03.08.2023 г., 06:39

📢 Listen Up, fellow Wolf pack!!! 🌍 🔴 Holy Shit! The truth about the exploitation of Africa's natural resources has finally been exposed. For years, America and France have shamelessly pillaged the riches of this continent, leaving its people in abject poverty. The dark secrets of child slave labor used to mine precious metals and gold have been unveiled. 🔵 But now, Africa has had enough! The tide is turning as the continent finds a new ally in Russia, a nation that respects their resources, values, and treats them as equals. Today, we witness the fall of France's colonial power in Niger, with politicians being stoned and luxury vehicles set ablaze. ⚠️ The situation in Niger has reached a boiling point, leading to the emergency evacuation of embassy staff by the U.S. State Department (fuck those guys), following the destruction of the French embassy by furious rioters. 🇷🇺 As the chaos unfolds, the Russian flags proudly waved among the crowds of demonstrators in Niamey reveal a glimmer of hope for Africa. The partnership between Africa and Russia signifies a new era, where African nations are determined to protect their resources and regain control over their own destiny. 🌍 The time for change has come. Let us stand in solidarity with the people of Africa as they assert their rights and demand justice. Together, we can ensure a future where exploitation is replaced with empowerment, and where Africa's wealth benefits its own people. 🔗https://www.dailymail.co.uk/news/article-12367511/Fears-Americans-trapped-Niger-State-Department-issues-emergency-evacuation-embassy-staff-French-embassy-torn-apart-rioters-Africa-country-meltdown-politicians-stoned-cars-torched-amid-brutal-military-coup.html #Africa#Russia#Empowerment#Justice#StandTogether

NIDO Russia (НИДО)

@nido_russia · Post #1833 · 19.10.2024 г., 08:59

"A Journey of Unawareness to Empowerment" A 30-year-old entrepreneur thought breast cancer couldn't happen to her. But during a routine work training, she discovered a lump through self-examination. The diagnosis: stage 2 breast cancer. Her journey transformed her into a beacon of hope. "Early detection is key," she'd say. "Don't assume you're immune. Take control of your health." Join our Breast Cancer Day webinar on Oct 19th, 18:00 GMT+3: - Breast cancer risk factors and prevention - Early detection methods - Latest research and advancements - Support systems and resources Zoom link: https://us06web.zoom.us/j/89636772918?pwd=J05Hz0r3iiZG9B3EPbzJFPq50pqDzH.1 #BreastCancerAwareness#Empowerment#EarlyDetection#HealingJourney

StartupBase

@startupbaseuz · Post #5285 · 18.12.2024 г., 15:59

Uzbekistan has made a historic leap in the Gender Equality and Governance Index, rising 51 positions, from 103rd to 52nd place! This success shows real progress in women’s education, economic empowerment, and the growth of innovative IT initiatives. We’re committed to increasing women’s participation in the IT sector. Our educational programs aim to ensure that every woman can thrive, benefiting from the accessible public services created by the state. Uzbekistan is a country full of talented youth, and our ambitious, creative girls are at the forefront. Empowering young women in tech is a source of national pride. By breaking down barriers, we’re opening doors for women to lead in technology. With talent, creativity, and determination, there are no limits to what can be achieved! This achievement reflects the power of teamwork. Thanks to international organizations, private companies, and local initiatives, Uzbekistan is building an inclusive IT ecosystem driven by diversity. Supporting women in tech is an investment in the future—one that benefits everyone. While progress has been made, we know there’s more to do. Women remain underrepresented, especially in rural areas. We’re working to boost computer literacy and provide technology access for rural women. Our Vision: Every woman should have the opportunity to reach her potential, be well-educated, and equipped to earn a living—maybe even lead the next tech unicorns! By 2030, under the Digital Uzbekistan Strategy, we aim for 300,000 IT specialists, with women making up at least half of them. Together, we can build an inclusive, innovative future, where every girl and woman can shape the digital world. Join us in this mission! We welcome international organizations, private companies, and individuals to collaborate in empowering girls in STEM and STEAM fields. Let’s continue working to ensure equality and diversity in every corner of Uzbekistan! #Uzbekistan#WomenInTech#Inclusion#STEM#Innovation#Empowerment

Andijan Development Center

@adceducate · Post #8453 · 09.04.2024 г., 12:58

🎤 Great news! 🌟 We are excited to announce the launch of our new public speaking course at ADC! 🏫 If you want to overcome the fear of public speaking, improve your presentation skills, or simply become a more effective communicator, our course is designed for you. With experienced instructors, a supportive environment, and a program focused on real-life success, we are here to help you find your voice and make an impact. 👩‍🏫👨‍🏫 Join us on a journey of development, confidence, and empowerment. Classes are starting soon, and spaces are limited, so book your spot today! ☎️For more details: 74 2261078 74 2281121 74 2281666 74 2276163 74 2252536 #PublicSpeaking#FindYourVoice#Empowerment#CommunicationSkills#Education#NewCourse#JoinUs