@PensivePost · Post #5371 · 23.08.2021 г., 18:31
#yourreview#review Could relate to the core! 'Filled with people deaf,dumb and blind' Simple and impactful and apt
Hashtags
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
Пребарај: #yourreview
@PensivePost · Post #5371 · 23.08.2021 г., 18:31
#yourreview#review Could relate to the core! 'Filled with people deaf,dumb and blind' Simple and impactful and apt
Hashtags
@PensivePost · Post #5105 · 15.04.2021 г., 11:34
#review #yourreview #thoughts Indeed the water rises, indeed the rivers flow, Beneath them mighty waves, Pondering and degrading the earth that knits their path. I see a gash, like a mighty wind, A tide too unbreakable by the screams of fear. And as it all comes to a still, The earth smelling fresh again, The frogs croaking, The crickets tuning a melody. And like the old grandma's hut, A smoke rises on the moist tatched kitchen, A meal, God has provided, The land will bear fruit, The children will have something, Cause the owner of the land, Has commanded it to yield. I see the villagers smile, A tune and a libation, For a cry is heard, A perfect gift of a son, I hear the drummers play the tom toms, I feel the harmony of the ululation, Tomorrow the women will gather together, To welcome and teach the young mother, How to love and to hold her little one. It is beautiful, the heart cannot contempt. Surely, tomorrow, the sun will rise again and we will smile. We will allow every rhythm and melodies made by life to flow to our hearts through the ears, We will love, we will rejoice and we will call it a blessed land
Hashtags
@PensivePost · Post #5170 · 06.05.2021 г., 06:10
I knew a girl who liked to draw, Pictures for only her eyes. She was more artistic late at night. Her drawings were different, No paper, No pen. But she needed a bandage, And wore long sleeves twenty-four/seven. We stood by the river, Under the stars, When she rolled up her sleeves And showed me her scars. She felt embarrassed and stared at her shoe. Then I rolled up my sleeves and whispered, "I draw too." #review#yourreview#noob
Hashtags
@PensivePost · Post #5007 · 18.03.2021 г., 09:30
My tears,Your tears. Our face grew hot as the fire. This mood can strike . Erupting in loud shouts, Like an extra. Wondering why we're here. Our mouth leaks with affection. My words,Your intention. Let us know our feelings. Electricity runs through our veins Shadows seem to follow. Snacking on sweet and sour lollies Nobody understands Defeated like deflated balloons Cowering in the corner at night. Our pains , we've future buzzing. I find a smile, It appears on your face. But it only widens When our heart flops together. #review #love #yourreview
Hashtags
@PensivePost · Post #5704 · 03.05.2022 г., 18:13
#iam#Rocky#yourreview#review Love the way you are Hey buddy, yes you, one who is reading this, you may be alone, not having many friends unlike others, not having enough money to live up to your dreams, may be to even fulfil your small and cutest wishes, you might be tied up all day with your course books, stressful office work, those computers and the hectic tasks, you might be feeling like running away from all your problems and just forget about all your worries, those stressful tasks and from toxic people and enjoy the beauty of the wonderful life. Buddy, you are not alone, me, you, all the top CEO’S, the world politicians, world class celebrities, sportsmen and many real life heroes were been in the same stressful situations, Just stay calm, just feel the beauty of nature, love yourself, love the way you are, the way you are living your life. Have some inner peace, don’t be very harsh on yourselves, just believe in your dreams ,focus on your goals, your passion and nothing else. Don’t give a f* about all these f* things, the girl who rejected you, the friend who betrayed you, the relative who keeps judging you, the society which is putting you shame all the time. Just Focus on your dreams, which is going to bring a grand new reality to new. Remember, no matter where you are and what you are, how worse the situation is, always have that smile on your face, which is going to make all the difference. Bye Bye. (Rocky)
Hashtags
@PensivePost · Post #4841 · 30.01.2021 г., 06:20
#review#yourreview#sm#i’mABrokenMan I’m a broken man don’t know who to trust. Being a broken man allows you not to trust. I’m a broken man with lots of blood, bleeding from the heart like a river. Being a broken man helps people raft on the red stream And they don’t give a damn, whether you die in shiver The moon is the only friend who acknowledges my tears. Stars, like a bodyguard help me fight out my fears. But sun, sometimes behaves as a foe for his rays of light, focuses me to reach my actual height. Nevertheless, I’m a broken man. Broken down piece by piece by the sword, of the goddess of beauty sharpened up with innocence, cunning ferocity. Never even cared, if I’m happy or sad, wouldn’t even matter if I’m alive or dead. I’m a broken man, who knows how to fix the glasses. But, being a broken man, There comes a why. Why even bother , rebuilding it. Everything broken down into bits and pieces. And so am I.
Hashtags