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

Резултати

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

Пребарај: #megaliths

当前筛选 #megaliths清除筛选
Interesting Planet 🌍

@interesting_planet_facts · Post #1374 · 15.04.2026 г., 12:11

🌎 The giant Trilithon stones at Stonehenge in England each weigh about 25 tons and were transported from over 30 kilometers away. These standing stones date to around 2500 BCE and were arranged in a unique horseshoe pattern that still stands today. ✨ #archaeology⚡#megaliths⚡#history 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #1293 · 14.02.2026 г., 22:11

🌎 Towering over the Peruvian desert, the megalithic complex of Sacsayhuamán features walls made from stone blocks weighing up to 200 tons each. These blocks fit so precisely that even a piece of paper cannot slide between them. ✨ #archaeology⚡#history⚡#megaliths 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #1110 · 08.12.2025 г., 12:11

🌎 Rising above the Jordanian desert, the prehistoric megaliths known as “desert kites” are vast stone structures with funnel-shaped walls stretching for hundreds of meters. Archaeologists have identified more than 6,000 desert kites across the Middle East, mostly built between 7000 BCE and 2000 BCE, likely used to trap wild animals. ✨ #archaeology⚡#megaliths⚡#history 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #1078 · 27.11.2025 г., 18:11

🌎 Looming over the English Channel, the Carnac stones on Guernsey form a megalithic passage grave known as Le Déhus. Built around 3500 BCE, it features a massive stone chamber and carved capstones. The longest stone weighs nearly 10 tons and the site is aligned to the sunrise at midsummer. ✨ #archaeology⚡#megaliths⚡#history 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #1047 · 17.11.2025 г., 18:11

🌎 Hidden in the forests of western Russia, the megalithic dolmens of the Caucasus feature massive stone chambers built from precisely carved granite slabs. Some of these structures date back over 5,000 years and weigh more than 15 tons each, puzzling archaeologists with their construction methods and unknown cultural origins. ✨ #megaliths⚡#archaeology⚡#history 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #968 · 26.10.2025 г., 18:11

🌎 Stonehenge in England features massive upright stones called sarsens, each weighing up to 25 tons. Built around 2500 BCE, the monument’s purpose is still debated, but recent studies found the stones were transported from over 25 kilometers away on wooden sledges and rollers. ✨ #archaeology⚡#megaliths⚡#history 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #832 · 29.09.2025 г., 15:11

🌎 The megalithic site of Carnac in Brittany, France, contains over 3,000 standing stones arranged in rows stretching more than 4 kilometers. Erected between 5000 and 3300 BCE, these granite monoliths are among the world’s largest collections of ancient stone alignments. ✨ #archaeology⚡#megaliths⚡#history 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #1234 · 18.01.2026 г., 18:11

🌎 In southern England, the ancient monument of Silbury Hill rises 40 meters and was built over 4,000 years ago using chalk and earth. Archaeologists have never found burials, temples, or inscriptions inside, leaving its purpose mysterious. Silbury Hill is the largest man-made prehistoric mound in Europe. ✨ #archaeology⚡#mystery⚡#megaliths 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #941 · 20.10.2025 г., 20:11

🌎 The “Plain of Jars” in Laos is scattered with thousands of massive stone jars, some weighing over 10 tons. Archaeologists date them to the Iron Age, around 500 BCE to 500 CE, but their purpose—possibly for funerary or storage rites—remains uncertain. Over 90 jar sites have been documented across the region. ✨ #archaeology⚡#megaliths⚡#mystery 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #1198 · 06.01.2026 г., 18:11

🌎 The Baalbek Trilithon in Lebanon features three enormous stone blocks, each weighing around 800 tons, forming the base of the Roman Temple of Jupiter. These stones are among the heaviest ever used in ancient construction, and were quarried and moved more than 800 meters from their original location. ✨ #archaeology⚡#megaliths⚡#engineering 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #802 · 23.09.2025 г., 15:11

🌎 Towering in the remote Pacific, the moai statues of Easter Island were carved from volcanic rock between 1400–1650 CE. The heaviest moai weighs around 82 tons, showcasing the islanders’ exceptional engineering with limited technology. ✨ #megaliths⚡#archaeology⚡#engineering 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #667 · 01.09.2025 г., 03:22

🌎 Rising from the Lebanese landscape, the megalithic stones of Baalbek include the Stone of the Pregnant Woman—one of the world’s largest quarried stones at over 1,000 tons. Ancient builders moved and stacked these limestone giants with such precision that modern engineers still debate the techniques used. ✨ #archaeology⚡#megaliths⚡#engineering 👉subscribe Interesting Planet ​

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