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

Резултати

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

Пребарај: #highprotein

当前筛选 #highprotein清除筛选
Dishes.Cooking.Food

@cookingdish · Post #786 · 27.03.2025 г., 14:02

High Protein Sushi Bowl 🍣💪 Ingredients: 🍚 100g rice 🥩 40g soy medallions 🥣 300ml vegetable broth 🥑 1/2 avocado 🌱 2 tbsp kidney beans 🌱 2 tbsp chickpeas 🌽 2 tbsp corn 🍥 1 tbsp pickled ginger 🥒 1/4 cucumber 🥕 1 carrot 🧂 Salt, pepper Sauce: 🧄 1 garlic clove 🌿 1 cm ginger 🍶 15ml soy sauce 🥜 60g peanut butter 💧 20ml water 🌶 1/2 tsp chili flakes Toppings: ⚪️ Sesame 🥜 Peanuts 🌶 Chili Preparation: 1. 🍚 Cook rice. 2. 🌱 Soak soy medallions in vegetable broth, drain, then fry in oil with pepper. 3. 🥒 Cut vegetables. 4. 🥣 Mix all liquid ingredients for the sauce. Grate ginger and garlic, stir in with chili flakes. 5. 🍲 Assemble the bowl. #ProteinPower💪#VeganSushiBowl🥗#HighProtein @dishes

Dishes.Cooking.Food

@cookingdish · Post #582 · 16.11.2024 г., 15:36

High Protein Sushi Bowl 🍣💪 Ingredients: 🍚 100g rice 🥩 40g soy medallions 🥣 300ml vegetable broth 🥑 1/2 avocado 🌱 2 tbsp kidney beans 🌱 2 tbsp chickpeas 🌽 2 tbsp corn 🍥 1 tbsp pickled ginger 🥒 1/4 cucumber 🥕 1 carrot 🧂 Salt, pepper Sauce: 🧄 1 garlic clove 🌿 1 cm ginger 🍶 15ml soy sauce 🥜 60g peanut butter 💧 20ml water 🌶️ 1/2 tsp chili flakes Toppings: ⚪ Sesame 🥜 Peanuts 🌶️ Chili Preparation: 1. 🍚 Cook rice. 2. 🌱 Soak soy medallions in vegetable broth, drain, then fry in oil with pepper. 3. 🥒 Cut vegetables. 4. 🥣 Mix all liquid ingredients for the sauce. Grate ginger and garlic, stir in with chili flakes. 5. 🍲 Assemble the bowl. #ProteinPower💪#VeganSushiBowl🥗#HighProtein @dishes

Dishes.Cooking.Food

@cookingdish · Post #575 · 09.11.2024 г., 16:00

High Protein Wan Tan Ingredients: For the dough: - 250 g flour 🌾 - 1 tsp salt 🧂 - 100 ml warm water 💧 For the filling: - 1 cm ginger 🫚 - 100 g soy granules 🌱 - 2 spring onions 🧅 - 2 cloves of garlic 🧄 - 3 mushrooms 🍄 - 1 carrot 🥕 - 4 tbsp soy sauce 🧴 - 1 tbsp starch 🌿 Additionally: - oil for frying 🛢️ - 100 ml water for steaming 💦 #HighProtein#WanTan#HealthyEating#Vegan @dishes

Dishes.Cooking.Food

@cookingdish · Post #787 · 28.03.2025 г., 14:04

High Protein Vegetable Patties 🥕 Ingredients: - 1 small carrot 🥕 - 1 medium potato 🥔 - 1/2 bell pepper 🌶 - 1 onion 🧅 - 50 g soy granules 🌱 - 50 g corn 🌽 - 50 ml water 💧 - 100 g flour 🌾 - 1 tbsp starch ✨ - Oil for frying 🍳 Preparation: 1️⃣ Grate the carrot & potato, dice the pepper & onion, and place in a bowl 🥣 2️⃣ Soak the soybean granules in water, then add to the bowl along with the remaining ingredients and mix well 👩‍🍳 3️⃣ Shape the dough into patties and sauté in a pan with a little oil until golden brown 🥘 Enjoy! 😋 #HighProtein#VegetablePatties#VeganRecipe#HealthyEating#PlantBased @dishes

Dishes.Cooking.Food

@cookingdish · Post #583 · 17.11.2024 г., 15:23

High Protein Vegetable Patties 🥕 Ingredients: - 1 small carrot 🥕 - 1 medium potato 🥔 - 1/2 bell pepper 🌶️ - 1 onion 🧅 - 50 g soy granules 🌱 - 50 g corn 🌽 - 50 ml water 💧 - 100 g flour 🌾 - 1 tbsp starch ✨ - Oil for frying 🍳 Preparation: 1️⃣ Grate the carrot & potato, dice the pepper & onion, and place in a bowl 🥣 2️⃣ Soak the soybean granules in water, then add to the bowl along with the remaining ingredients and mix well 👩‍🍳 3️⃣ Shape the dough into patties and sauté in a pan with a little oil until golden brown 🥘 Enjoy! 😋 #HighProtein#VegetablePatties#VeganRecipe#HealthyEating#PlantBased @dishes

Dishes.Cooking.Food

@cookingdish · Post #573 · 07.11.2024 г., 15:25

High Protein Zucchini Frittata 🥒🍅 Ingredients: • 450 g chickpea flour 🌱 • 800 ml water 💧 • 1 zucchini 🥒 • 10 cherry tomatoes 🍅 • 2 onions 🧅 • 1 tsp turmeric 🌞 • 1 tsp Kala Namak 🧂 • 1 tsp paprika powder 🌶️ • Pinch of salt & pepper 🧂 Toppings: • Cherry tomatoes 🍅 • Onion rings 🧅 • Italian herbs 🌿 Preparation: 1️⃣ Mix chickpea flour with water and season 🌱 2️⃣ Add vegetables and let rest for 10 minutes ⏳ 3️⃣ Heat some oil in a pan and add the mixture; decorate with toppings 🥄 4️⃣ Cover and cook on low heat for 20 minutes 🔥⏳ #FrittataTime#HighProtein#ZucchiniRecipe#VeganDelight#HealthyEating#PlantBasedCooking @dishes

Dishes.Cooking.Food

@cookingdish · Post #785 · 26.03.2025 г., 14:01

High Protein Quinoa Balls in African Peanut Stew 🥣Quinoa Balls: - 150g quinoa 🍚 - 1 red onion 🧅 - 2 cloves garlic 🧄 - 2 tbsp oatmeal 🌾 - 50g soy granules 🌱 - 1 tbsp vegetable broth 🥬 - 4 tbsp cornstarch 🌽 - Salt & pepper 🧂 🍲Peanut Stew: - 2 cm ginger 🫚 - 1 chili 🌶 - 2 onions 🧅 - 2 cloves of garlic 🧄 - 1 bell pepper 🫑 - 2 carrots 🥕 - 1 bunch of spring onions 🧅 - 300 ml vegetable broth 🥣 - 200g tomato paste 🍅 - 150g peanut butter 🥜 - Fresh parsley & cilantro 🌿 - 1 tsp cumin 🌿 - 1 tsp paprika 🌶 #HighProtein#QuinoaBalls#PeanutStew#HealthyRecipe#AfricanInspired#VeganCooking#PlantBased#ComfortFood @dishes

Dishes.Cooking.Food

@cookingdish · Post #581 · 15.11.2024 г., 14:28

High Protein Quinoa Balls in African Peanut Stew 🥣Quinoa Balls: - 150g quinoa 🍚 - 1 red onion 🧅 - 2 cloves garlic 🧄 - 2 tbsp oatmeal 🌾 - 50g soy granules 🌱 - 1 tbsp vegetable broth 🥬 - 4 tbsp cornstarch 🌽 - Salt & pepper 🧂 🍲Peanut Stew: - 2 cm ginger 🫚 - 1 chili 🌶️ - 2 onions 🧅 - 2 cloves of garlic 🧄 - 1 bell pepper 🫑 - 2 carrots 🥕 - 1 bunch of spring onions 🧅 - 300 ml vegetable broth 🥣 - 200g tomato paste 🍅 - 150g peanut butter 🥜 - Fresh parsley & cilantro 🌿 - 1 tsp cumin 🌿 - 1 tsp paprika 🌶️ #HighProtein#QuinoaBalls#PeanutStew#HealthyRecipe#AfricanInspired#VeganCooking#PlantBased#ComfortFood @dishes

Dishes.Cooking.Food

@cookingdish · Post #569 · 03.11.2024 г., 14:44

High Protein Sweet & Sour Udon Noodles 🍜💪 Ingredients: - 250 g udon noodles 🍜 - 80 g pea or soy medallions 🌱 (vegetable broth) - 2 carrots 🥕 - 100 g sugar snap peas 🍃 - 200 g mushrooms 🍄 - 1/2 bunch of spring onions 🧅 Sauce: - 2 tbsp sesame oil 🌾 - 1 tbsp soy sauce 🧂 - 3 tbsp agave syrup 🍯 - 2 tbsp rice vinegar 🍚 - 50 ml pasta water (from the udon noodles) 💧 - 1 tsp sesame seeds 🌿 - 1 tsp chili flakes 🌶️ Instructions: 1. Cook udon noodles in boiling water as per instructions. Save 50 ml of pasta water. 🍲 2. In vegetable broth, cook soy or pea medallions until tender. 🥄 3. Slice carrots, sugar snap peas, mushrooms, and spring onions. 🍄🥕🍃 4. Heat sesame oil in a pan, add veggies, and stir-fry until tender-crisp. 🍳 5. Add soy sauce, agave, rice vinegar, pasta water, sesame seeds, and chili flakes to the pan. 🍶 6. Combine everything, serve, and enjoy! 😋 #SweetAndSourNoodles#HighProtein#PlantBased#UdonLove#HealthyEats#VeganNoodles#QuickMeals#FoodieFun @dishes

Dishes.Cooking.Food

@cookingdish · Post #557 · 23.10.2024 г., 13:27

High Protein Red Cabbage Rolls Ingredients: 🥬 1 large red cabbage 🫚 4 cm ginger 🧄 3 cloves of garlic 🥕 2 carrots 🫑 2 peppers 🧅 2 spring onions 🌱 100 g soy granules 🍶 50 ml soy sauce Toppings: ✨ Sesame, 🌿 fresh parsley, 🌶 chili flakes Dip: 🍯 Sweet Chili Sauce #HighProtein#RedCabbageRolls#HealthyEating#PlantBased#EasyRecipe#SoyGranules#VeggiePower#Flavorful#MealPrep @dishes