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

Резултати

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

Пребарај: #gamma

当前筛选 #gamma清除筛选
Hi, AI • Noticias sobre la IA

@hiaimediaes · Post #819 · 21.04.2025 г., 16:36

🔄Gamma: сrea presentaciones en solo unos clics con IA La reciente actualización del servicio de creación de presentaciones impulsado por IA, Gamma, ha ampliado sus capacidades: ahora genera no solo texto e imágenes, sino también tablas con gráficos, convierte diapositivas en tarjetas para redes sociales y te permite elegir entre ilustraciones originales además de imágenes generadas por IA. ¿Cómo crear una presentación en Gamma? 1️⃣ Ve al sitio web de Gamma,haz clic en "Start for Free" y regístrate. 2️⃣Haz clic en "Create New AI" y elige una de las opciones para generar tu presentación: basada en tu esquema, completamente generada por IA o cargando una presentación existente para editarla. 3️⃣ Selecciona el tipo de proyecto (presentación, sitio web, documento o publicación en redes sociales), el número de diapositivas, el idioma y haz clic en "Create Outline". 4️⃣ Revisa el contenido del esquema. Elige un diseño, el método de creación de imágenes, agrega preferencias de estilo y haz clic en "Generate!" 4️⃣ La IA comenzará inmediatamente a crear tu presentación. Puedes editar manualmente las diapositivas, realizar cambios a través del chatbot, animar ilustraciones y crear infografías. 💲 Al registrarte, recibirás 400créditos, suficientes para crear 10 presentaciones. Recuerda que todas las ediciones con IA consumen créditos adicionales (a partir de 10 por edición). Gamma es una excelente herramienta para estudiar, crear contenido para redes sociales o prototipar sitios web rápidamente. Más sobre este tema: 🔆Nuestras guías de productividad 🔆Herramientas gratuitas de IA para estudiar #noticias#Gamma@hiaimediaes

Interesting Planet 🌍

@interesting_planet_facts · Post #1122 · 12.12.2025 г., 12:11

🌎 Gamma-ray bursts are the most energetic explosions in the universe, releasing in seconds as much energy as the Sun emits over its entire 10-billion-year lifespan. They are detected by satellites as brief flashes of gamma radiation, and are thought to result from collapsing massive stars or merging neutron stars. ✨ #space⚡#gamma⚡#astrophysics 👉subscribe Interesting Planet 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #686 · 17.02.2026 г., 22:21

🪐 In 2013, the Fermi Gamma-ray Space Telescope detected GRB 130427A, one of the most energetic gamma-ray bursts ever observed, originating from the constellation Leo. This explosion unleashed a gamma-ray photon with an energy of 94 billion electron volts—over 20,000 times more energetic than visible light—demonstrating how gamma-ray bursts can produce some of the most extreme energy events in the universe. ✨ #gamma⚡#gamma-ray-bursts ⚡#space-explosions ⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #483 · 07.11.2025 г., 12:21

🪐 In the galaxy ESO 184-G82, astronomers observed GRB 980425—a gamma-ray burst that was directly linked to a supernova explosion called SN 1998bw. Gamma-ray bursts are intense flashes of the highest-energy light in the universe, and the connection in ESO 184-G82 revealed that some of these powerful bursts are caused when massive stars end their lives in energetic supernovae, giving scientists a rare glimpse into how the most violent stellar deaths can unleash extraordinary cosmic fireworks. ✨ #gamma-ray-bursts ⚡#supernovae⚡#galaxies⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #463 · 28.10.2025 г., 22:21

🪐 In the spiral galaxy NGC 3310, astronomers have observed a rare "gamma-ray burst afterglow," the fading embers following one of the universe’s brightest explosions. This lingering glow, seen in visible light and X-rays, lets scientists track how shockwaves from the original burst plow through space, revealing clues about the powerful forces unleashed when massive stars die. ✨ #gamma-ray-bursts ⚡#strange-cosmic-phenomena ⚡#galaxies⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #587 · 28.12.2025 г., 22:21

🪐 Some gamma-ray bursts last less than two seconds and are thought to result from the collision of two neutron stars—ultra-dense remnants of massive stars that pack more mass than the Sun into a space the size of a city. In 2017, the galaxy NGC 4993, about 130 million light-years away, was the site of such a collision, allowing astronomers to observe both gamma rays and gravitational waves from the same cosmic event—a rare glimpse into the most violent mergers in the universe. ✨ #gamma-ray ⚡#neutronstar⚡#gravitationalwaves⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #292 · 18.09.2025 г., 16:11

🪐 In the spiral galaxy NGC 4993, scientists observed a gamma-ray burst, GRB 170817A, that arrived just 1.7 seconds after gravitational waves from the merger of two neutron stars—ultra-dense stellar remnants. This remarkable event marked the first time both gravitational waves and a gamma-ray burst were detected from the same source, giving astronomers an unprecedented, multi-messenger view of a cosmic collision. ✨ #gamma⚡#astrophysics⚡#neutronstars⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries ​

Universe Mysteries 🪐

@cosmomyst · Post #343 · 28.09.2025 г., 18:21

🪐 The galaxy Swift J1644+57, located about 3.9 billion light-years from Earth, produced a gamma-ray burst in 2011 so powerful it was visible across the universe. This extraordinary event happened when a star wandered too close to the galaxy’s central black hole, got torn apart, and unleashed jets of high-energy gamma rays—showing how black holes can create some of the brightest, most dramatic explosions ever observed in space. ✨ #gamma-rays ⚡#blackholes⚡#starburst⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #415 · 12.10.2025 г., 22:21

🪐 On August 27, 1998, astronomers detected a remarkable gamma-ray burst from the magnetar SGR 1900+14, located about 20,000 light-years away in the constellation Aquila. This event released more than a thousand times the energy of the Sun in just a fraction of a second, making it one of the brightest gamma-ray flashes ever recorded and proving that magnetars—neutron stars with ultra-strong magnetic fields—can unleash explosions powerful enough to briefly outshine entire galaxies. ✨ #gamma-ray-bursts ⚡#magnetar⚡#cosmic-explosions ⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #502 · 16.11.2025 г., 22:21

🪐 In 2021, astronomers detected a record-breaking gamma-ray burst called GRB 211211A, which defied expectations by lasting over a minute—much longer than most "short" bursts thought to arise from merging neutron stars. Observations with space telescopes revealed this unusually long burst likely came from the merger of two neutron stars in a distant galaxy, showing that cosmic collisions can create gamma-ray explosions with a wider variety of durations and energies than previously believed. ✨ #gamma-ray-bursts ⚡#neutron-stars ⚡#cosmic-explosions ⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #365 · 02.10.2025 г., 22:21

🪐 In December 2004, the galaxy NGC 1637 in the constellation Eridanus was the source of a rare and powerful cosmic event known as a "short gamma-ray burst." Lasting less than two seconds, these bursts are believed to result from the merger of two neutron stars—ultra-dense remnants of massive stars—which create a flash of high-energy gamma rays strong enough to briefly outshine entire galaxies before fading away in moments. ✨ #gamma-rays ⚡#neutron-stars ⚡#cosmic-explosions ⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

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