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

Резултати

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

Пребарај: #archaeology

当前筛选 #archaeology清除筛选
Amazing Geography 🌍

@amazingeo · Post #143 · 30.08.2025 г., 09:12

🌍 Machu Picchu in Peru was built atop a mountain ridge by the Incas around 1450. Its stone walls fit together so precisely that some areas withstand earthquakes without mortar. ✨ #heritage⚡#archaeology⚡#mountains⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography🌍 ​

Amazing Geography 🌍

@amazingeo · Post #679 · 01.04.2026 г., 20:31

🌍 Machu Picchu in Peru is a heritage site set amid mountain peaks and cloud forests. Its stone terraces and temples blend ancient Inca engineering with dramatic natural scenery. ✨ #heritage⚡#archaeology⚡#landscape⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40688 · 21.02.2026 г., 15:00

A gold coin found in 1713 in Transylvania is likely genuine. The coin shows a Roman ruler named Sponsian, who was long believed to be fictional. Tests found real ancient wear and soil deposits, suggesting he was a real leader during the 3rd-century Roman crisis. 🪙🏛️ [Read more] @googlefactss #history#ancientrome#archaeology#facts

Amazing Geography 🌍

@amazingeo · Post #485 · 30.11.2025 г., 12:31

🌍 The ancient city of Angkor in Cambodia covered more land than any other pre-industrial city, with a vast network of canals and reservoirs that shaped both its culture and the landscape for centuries. ✨ #historicalgeography⚡#archaeology⚡#settlement⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #678 · 31.03.2026 г., 20:31

🌍 The lost city of Cahokia once stood near present-day St. Louis, with earthen mounds and a population rivaling European cities around 1100 CE—making it North America’s largest urban center before Columbus. ✨ #historicalgeography⚡#archaeology⚡#civilization⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #1326 · 03.03.2026 г., 22:11

🌎 In the Nevada desert, the 2,000-year-old Lovelock Cave yielded mysterious oversized sandals, giant bones, and duck decoys. While duck decoys are confirmed as Native American artifacts, reports of giant bones and massive sandals remain unverified, fueling legends of a lost tribe. Archaeologists still debate the origins and meaning of these unusual finds. ✨ #history⚡#archaeology⚡#mystery 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #1251 · 24.01.2026 г., 12:11

🌎 The disappearance of the 1,200-year-old Maya city of El Mirador remains an unsolved mystery. Once a major metropolis with vast pyramids in Guatemala, it was suddenly abandoned around 150 CE. Archaeologists have not found evidence of war, plague, or fire to explain why its tens of thousands of residents left so abruptly. ✨ #history⚡#archaeology⚡#mystery 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #1225 · 15.01.2026 г., 18:11

🌎 The disappearance of the Ninth Roman Legion, Legio IX Hispana, remains one of history’s greatest unsolved mysteries. Records show the legion vanished from Roman chronicles after around 120 CE in Britain. Despite searches, no definitive evidence of its fate or mass grave has ever been found. ✨ #history⚡#mystery⚡#archaeology 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #962 · 24.10.2025 г., 22:11

🌎 The mysterious ancient city of Great Zimbabwe was built using massive stone walls without mortar, yet no written records explain how its builders achieved such precise engineering. Archaeologists estimate the complex appeared between the 11th and 15th centuries and covers over 7 square kilometers. ✨ #history⚡#archaeology⚡#mystery 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #886 · 10.10.2025 г., 12:11

🌎 In 2014, archaeologists uncovered a set of 2,000-year-old Roman lead tablets in a well in Britain. These inscribed tablets feature curses, prayers, and personal wishes, puzzling researchers with unusual languages and names not seen in surviving Roman texts. Over 130 of these "curse tablets" were recovered from the site in Bath. ✨ #archaeology⚡#mystery⚡#history 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #862 · 05.10.2025 г., 15:11

🌎 The lost city of Ubar, often called the "Atlantis of the Sands," is a legendary ancient settlement thought to be buried under Oman’s deserts. Satellite imagery and excavations in the 1990s revealed buried structures at Shisr, but no proof has confirmed Ubar’s identity or vast wealth described in Arabian lore. ✨ #history⚡#mystery⚡#archaeology 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #817 · 26.09.2025 г., 15:11

🌎 The disappearance of the English colony at Roanoke Island in the late 16th century remains unsolved. When resupply ships arrived in 1590, the settlers were gone, with "CROATOAN" carved into a post as the only clue. Archaeologists have found no definitive evidence, and the fate of over 100 people is still a mystery. ✨ #history⚡#archaeology⚡#mystery 👉subscribe Interesting Planet 👉more Channels ​

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