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

Резултати

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

Пребарај: #arctic

当前筛选 #arctic清除筛选
RTDocumentary

@rtdocumentary · Post #467 · 27.02.2022 г., 10:20

#video#Arctic On the 80th parallel north, there’s not much life. It’s a vast icy desert with the occasional polar bear in the distance. Nevertheless, Russian researchers have been travelling nearly to the top of the world since 1937 to collect data from the Arctic region. They used to land on an old thick ice floe to live and work on it for almost a year. Then, they slowly drifted across the Arctic ocean. But warmer temperatures mean the ice cover is melting rapidly. So expeditions had to be evacuated after the ice gave way under their drifting stations. They’ve come up with the ‘ship and ice’ polar station when researchers work on the ice but can retreat to the safety of a vessel. We joined an expedition aboard the Akademik Tryoshnikov. Follow: https://t.me/rtdocumentary

RTDocumentary

@rtdocumentary · Post #203 · 06.09.2021 г., 14:00

Have you ever wanted to go to the Arctic? #video#Arctic RT’s Konstantin Rozhkov travelled to the North Pole on a giant Russian nuclear-powered icebreaker to film the fascinating landscapes of one of the most beautiful but one of the riskiest places on our planet. Swimming in the icy waters of the Arctic Ocean and meeting a polar bear are just a few thrilling experiences he had there! However, a journey to the North Pole is not only about fun and beautiful views. It’s also about strong swell, extreme weather conditions, the polar day insomnia, and the complete absence of any communication services. How did Konstantin and his crew deal with their hardships? Watch North Pole: Inside a Russian Nuclear Icebreaker to find out! Follow: https://t.me/rtdocumentary

RTDocumentary

@rtdocumentary · Post #591 · 09.04.2022 г., 15:05

#photo#Arctic Did you know that at up to three meters, Arctic ice is so thick that ships can’t pass even following an icebreaker? That’s why icebreakers like Taymyr have to pull them with steel tow lines. RT Documentary’s Natalya Kadyrova is on board the Taymyr icebreaker once again. Taymyr is giving her crew a ride to another vessel, Sibir, in the Kara Sea. The captain of Taymyr is Natalya’s old friend. When she first filmed in the Arctic nine years ago, he was chief mate. ‘It’s funny to find yourself again on this charming ship after so many years and so many vessels,’ Natalya says. ‘Not far from the icebreaker are fishermen. Fishing for smelt is underway - they can’t be disturbed. Plus, they’re used to icebreakers. There are many vessels these days. Apparently, there will be more soon.’ For more about the icebreakers in the Arctic, watch our documentary, Seven Seas of Ice. Follow: https://t.me/rtdocumentary

Amazing Geography 🌍

@amazingeo · Post #191 · 07.09.2025 г., 03:12

🌍 The Canadian Arctic Archipelago includes over 36,000 islands, making it one of the most complex island groups on Earth. These remote lands are mostly uninhabited and covered by ice much of the year. ✨ #islands⚡#arctic⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography🌍 ​

Interesting Planet 🌍

@interesting_planet_facts · Post #1271 · 03.02.2026 г., 22:11

🌎 Arctic woolly bear caterpillars survive harsh winters by freezing solid, stopping their heart and body fluids. They produce a natural antifreeze called glycerol to avoid ice damage. Some individuals take up to 14 years to mature into moths through repeated freeze-thaw cycles. ✨ #animals⚡#adaptation⚡#arctic 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #456 · 29.07.2025 г., 13:22

🌎 In the icy landscapes of Greenland, musk oxen survive Arctic winters thanks to an incredibly dense undercoat called qiviut, which is eight times warmer than sheep’s wool. This soft fiber insulates these shaggy animals so well that snow won't melt on their backs, even in the harshest cold. ✨ #mammals⚡#adaptation⚡#arctic 👉subscribe Interesting Planet

Interesting Planet 🌍

@interesting_planet_facts · Post #1216 · 12.01.2026 г., 18:11

🌎 In 1845, Sir John Franklin led two ships, HMS Erebus and HMS Terror, to chart the Northwest Passage. All 129 crew vanished. Evidence from later searches, including abandoned camps and preserved bodies, showed the crew faced lead poisoning, starvation, and harsh Arctic conditions. The ships’ wrecks were only rediscovered in 2014 and 2016. ✨ #exploration⚡#arctic⚡#history 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #551 · 13.08.2025 г., 03:22

🌎 Lightning rarely strikes the North Pole, but climate change is making Arctic storms more common. Recent years have seen record-breaking lightning outbreaks near the pole’s icy expanse. ✨ #climate⚡#lightning⚡#arctic 👉subscribe Interesting Planet

Политическая П

@politpe · Post #19563 · 27.12.2025 г., 12:04

Трамп вернулся к теме Гренландии Символично, что и начинался этот и без того насыщенный год с резонансных заявлений американского президента о необходимости присоединения острова к США. И вот на этой неделе Трамп назначил спецпосланника США по Гренландии, тем самым поставив этот вопрос в один ряд с такими внешнеполитическими приоритетами, как Ближний Восток или Украина. Что касается самого спецпосланника, им стал губернатор Луизианы Джефф Лэндри. Недавно ему исполнилось 55, он имеет степень в области экологических наук и бизнеса, а также степень юриста. Его политическая платформа традиционно консервативна, с акцентом на поддержку энергетической отрасли, особенно нефти и газа. Биография Джеффа Лэндри не связана с Арктическим регионом, да и руководит он южным штатом. Но, как известно, кадровую политику Белого дома сегодня определяет личная преданность Трампу. За вихрем информационных поводов, которые в этом году генерировал американский президент, могло показаться, что тема присоединения Гренландии плавно сошла на нет. Но нет. После назначения Лэндри поблагодарил Трампа и подтвердил намерение сделать Гренландию частью Соединенных Штатов. «Речь идет о серьезных планах с американской стороны в отношении Гренландии. Эти планы имеют давние исторические корни. И очевидно, что США будут и дальше на системной основе продвигать свои геостратегические, военно-политические и экономические интересы в Арктике», – говорил нам В.В. Путин на арктическом форуме в Мурманске. Здесь также хотелось бы отметить, что вся история с Гренландией укладывается в логику новой стратегии национальной безопасности США, предполагающей укрепление позиций Штатов в Западном полушарии. #Arctic#Greenland#Trump @semenenkol

Amazing Geography 🌍

@amazingeo · Post #337 · 05.10.2025 г., 20:31

🌍 In 2019, a remote underwater mountain range called the Gakkel Ridge was explored beneath Arctic ice. Scientists found hydrothermal vents in this frigid zone, revealing unknown deep-sea ecosystems. ✨ #exploration⚡#ocean⚡#Arctic⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #611 · 03.02.2026 г., 20:31

🌍 The Lena River in Siberia creates the largest natural river delta in the Arctic, spreading into thousands of channels and wetlands that provide vital nesting grounds for millions of migratory birds. ✨ #rivers⚡#wetlands⚡#Arctic⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #119 · 26.08.2025 г., 09:12

🌍 The Svalbard Archipelago, north of mainland Norway, is the northernmost year-round inhabited place on Earth. It’s so remote that polar bears outnumber people here during much of the year. ✨ #archipelago⚡#islands⚡#Arctic⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography🌍 ​

ПретходнаСтраница 1 од 4Следна