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

Резултати

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

Пребарај: #lifeatiras

当前筛选 #lifeatiras清除筛选
IRAS

@irassg · Post #1776 · 21.10.2025 г., 09:10

Earlier this year, IRAS and Singapore Institute of Technology (SIT) signed a Memorandum of Understanding (MOU) to cultivate top talents in the field of taxation through the IRAS Top Student Award in Taxation. Last Friday, we attended SIT’s convocation to congratulate Jason Toh Yong Ping, the first recipient of the IRAS Top Student Award in Taxation. We were honoured to celebrate this milestone with SIT and extend our heartfelt congratulations to Jason for his excellent academic achievements. IRAS remains committed to nurturing the next generation of tax professionals, and we look forward to celebrating more milestones with future graduates. #lifeatIRAS

Hashtags

IRAS

@irassg · Post #1591 · 04.07.2025 г., 09:00

Do you have someone to recommend joining IRAS? 🤝 They say great people know great people - tag a friend who you’d think makes an amazing addition to join our IRAS family! 😉 Find out more about IRAS and check out our opportunities at go.gov.sg/lifeatiras🌱 #lifeatIRAS

Hashtags

IRAS

@irassg · Post #1526 · 09.05.2025 г., 03:27

The town hall concluded with an engaging panel dialogue, where our senior management team addressed staff Q&As about culture-building and career development, demonstrating our commitment to building a supportive workplace. #LifeatIRAS

Hashtags

IRAS

@irassg · Post #1419 · 07.03.2025 г., 02:42

🎤 We’re passing the microphone to…women who play vital roles in IRAS! With International Women’s Day around the corner, we want to shine a spotlight on some of the incredible women in our workforce. Happy International Women’s Day 🌏✨ #lifeatIRAS

Hashtags

IRAS

@irassg · Post #2129 · 08.05.2026 г., 10:45

Today, we celebrated 49 outstanding winners at the One IRAS Awards, with our Commissioner Ow Fook Chuen, presenting the honours to individuals and teams who exemplify innovation, collaboration, and a drive to improve outcomes for taxpayers and colleagues alike. Across 12 award categories, this year saw a heartening rise in nominations from colleagues – a reflection of our culture of appreciation and recognition. Congratulations once again to all our winners for their inspiring contributions. Here's to the #IRASFam that brings passion and purpose to work every day! Together, we remain committed to delivering people-centric and pro-business outcomes for Singapore. #LifeatIRAS

IRAS

@irassg · Post #1752 · 13.10.2025 г., 09:44

This workshop was the culmination of months of thoughtful preparation, deep dives, and collaboration across teams — all driven by a shared ambition to reimagine how we can serve better, adapt faster, and create greater impact for Singapore. It was inspiring to see the energy, honest reflections and collective commitment in the room. As One IRAS, we’re charting the path towards a more connected, innovative, and future-ready organisation. #lifeatiras#irassg

IRAS

@irassg · Post #1737 · 09.10.2025 г., 09:22

We also recognised the contributions of our Accredited Tax Specialists (ATS) through the Technical Contribution Award, inducted our 15 newly accredited tax specialists, and celebrated the achievements of our Book Prize winners for the Advanced Tax Programme. Thank you to the 2025 ATC Organising Committee and all who have made this event possible! 🎉 #lifeatIRAS#irassg

IRAS

@irassg · Post #1548 · 29.05.2025 г., 09:01

We kay-poh and asked our colleagues what they do at IRAS 👀 Psst: it’s not all about taxes! Swipe to see some of the different roles we have here ➡️ Explore the roles available at go.gov.sg/lifeatiras #LifeatIRAS#irassg

IRAS

@irassg · Post #1535 · 15.05.2025 г., 06:31

#LifeatIRAS is not always the typical 9-5. Here's our team at the OECD/G20 Inclusive Framework on BEPS Plenary in Cape Town, where we joined delegates from all over the world to shape the future of international taxation 🌍 Want to build a meaningful career with the #IRASFam? Find opportunities at go.gov.sg/lifeatiras today!

IRAS

@irassg · Post #1528 · 09.05.2025 г., 09:19

What does a UI/UX Designer at IRAS do? Watch as our colleague's children take a guess at what she does for work, while she shares her thoughts on balancing work and motherhood. Wishing all the incredible mothers out there a Happy Mother's Day! 💐❤️ #irassg#lifeatIRAS

IRAS

@irassg · Post #1520 · 08.05.2025 г., 09:02

You heard it here first! IRAS is more than just Singapore's tax authority - we're a community of passionate individuals contributing to Singapore’s growth and progress. Join us today at go.gov.sg/lifeatiras #irassg#lifeatiras

IRAS

@irassg · Post #1352 · 23.01.2025 г., 08:50

In partnership with The Food Bank Singapore, we held a successful food donation drive at Revenue House yesterday, aimed at supporting various food relief initiatives, including community pantries, emergency food rations, and daily meal programmes. Thanks to the generous contributions of the #IRASFam, we were able to donate a significant number of non-perishable food items. The organising committee and dedicated volunteers worked tirelessly to ensure the smooth collection and sorting of donations throughout the day. This initiative not only allowed us to contribute to the fight against food insecurity but also showcased the strong teamwork at IRAS as we came together to make a meaningful impact this festive Lunar New Year season. #lifeatIRAS

123•••67
ПретходнаСтраница 1 од 7Следна