Что делать если нужно поставить какую-то 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
Australia's eSafety Commissioner Addresses Generative AI
Hi AI&Law society! The eSafety Commissioner of Australia has released a "Tech Trends Position Statement — Generative AI." This comprehensive guidance document assesses the current state of generative artificial intelligence, its life cycle, and provides instances of both favorable and unfavorable applications of this technology.
By offering insights into the potential benefits and challenges associated with generative AI, this position statement aims to inform stakeholders, foster responsible usage, and contribute to the ongoing dialogue surrounding the responsible deployment of AI technologies.
#AI#Australia#TechTrends#EthicalAI
Crypto Struggles: Bitcoin Outperforms All Segments
Delphi Digital reports significant declines across various crypto segments this year:
- AI frameworks: -84.05%
- Agents: -70.27%
- Meme tokens: -51.74%
- Gaming infrastructure: -51.54%
- Modular blockchains: -47.48%
- ETH DeFi: -35.2%
- SOL DeFi: -29.29%
Bitcoin only corrected ~5% this year, with a peak-to-trough drop of ~19%. For more details, read the full story here.
#Bitcoin#Crypto#MarketTrends#AI#DeFi#Investment#Blockchain#TechTrends#Statistics
New Insights on AI Agents Explained
Explore the latest article defining AI agents, focusing on task planning, validation, and execution techniques. It integrates various APIs and tools, emphasizing reflexive methods and error correction. Dive deeper into these design practices here.
#AI#Tech#Innovation#TaskPlanning#API#TechTrends
🤖 The moment he realized a robot just replaced his job.
在深圳街頭,一台全自動 AI 無人清掃機器人,安靜地完成了原本屬於人類的工作。
👇 留言告訴我 ! 你覺得 AI 是解放人類,還是淘汰人類?
沒抗議、沒公告、沒有倒數。
它只是出現,然後開始工作。
⚠️ 這不是科幻
⚠️ 這不是未來
⚠️ 這是正在發生的現在
當 AI 開始取代「體力+重複性」工作,
下一步會輪到誰?
#AI#Automation#FutureOfWork
#TechTrends#Ethereum#Web3
———
👇⭐️👇
🤣
🥲👇 資源搜索 🖲️👆
🚀 AI TRENDS | Anthropic Reportedly Considering In-House Chip Development
According to Jin10, sources indicate that Anthropic is exploring the possibility of developing its own chips. This move could potentially enhance the company's capabilities in artificial intelligence and reduce reliance on external suppliers. The decision to consider in-house chip production aligns with a broader trend among tech companies seeking greater control over their hardware components. Anthropic's initiative reflects the growing importance of customized hardware in advancing AI technologies.
#AI#Anthropic#ChipDevelopment#InHouseChips#ArtificialIntelligence#TechTrends#CustomHardware
🚀 AI TRENDS | OpenAI Claims Superior Computing Power Over Anthropic
OpenAI has informed investors that its computing capabilities surpass those of Anthropic. According to Jin10, this assertion highlights OpenAI's confidence in its technological advancements and competitive edge in the AI industry. The statement comes amid growing interest and investment in artificial intelligence, as companies strive to enhance their computational power and efficiency. OpenAI's claim may influence investor perceptions and decisions, potentially impacting market dynamics and the competitive landscape within the AI sector.
#AI#OpenAI#Anthropic#ArtificialIntelligence#ComputingPower#TechTrends#Investment#AIIndustry#MarketDynamics#Innovation
🚀 AI TRENDS | Anthropic Secures CoreWeave Data Center Capacity Amid Rising AI Demand
Anthropic has agreed to lease data center capacity from CoreWeave to address the growing demand for its AI services, Jin10 reports. CoreWeave announced on Friday that the multi-year agreement will assist Anthropic in building and deploying its Claude AI model. CoreWeave's CEO, Intrator, stated that the deal will involve various Nvidia chip architectures within U.S. data centers. The financial terms of the agreement were not disclosed by either company. Anthropic, similar to OpenAI, has been at the forefront of the AI service surge, sometimes struggling to maintain its products online due to what it describes as 'unprecedented demand.' Earlier this week, Anthropic revealed a collaboration with Broadcom and Google to secure 3.5 gigawatts of energy, noting that one gigawatt of power is sufficient to supply electricity to approximately 750,000 U.S. households simultaneously.
#AI#Anthropic#CoreWeave#DataCenter#ClaudeAI#Nvidia#Broadcom#Google#ArtificialIntelligence#TechTrends
🚀 AI TRENDS | Claude Unveils Managed Agents for Efficient Deployment
Claude has introduced Managed Agents, a new feature designed to support large-scale agent construction and deployment. According to Foresight News, this product combines an optimized agent framework with production-grade infrastructure, enabling developers to swiftly transition their agent products from prototype to official launch in just a few days. Managed Agents are currently in public testing on the Claude platform.
#AI#Claude#ManagedAgents#AgentDeployment#TechTrends#ForesightNews#AIPlatforms#SoftwareDevelopment#Innovation#PublicTesting
Investors Flock to Legal Tech Startups
Despite a downturn in the venture capital market, record investments were made last year in legal tech startups focusing on AI solutions. These startups are securing rounds of $50-100 million as investor interest surges. Read more here: FastFounder article
In other news, President Javier Milei of Argentina clarified that he only disseminated information about the LIBRA token, not promoted it, and confirmed meetings with individuals involved in its launch. This comes after a brief spike in LIBRA's price following his shared purchase instructions. Additionally, the CEO of Jupiter, Ben Chow, has resigned amid a rising scrutiny of the LIBRA project. Full News
#AI#Crypto#VC#LegalTech#StartupInvestment#Argentina#LIBRA#VentureCapital#Investment#Technology#M&A #Blockchain#XRP#SEC#Audit#Innovation#TechTrends#MarketTrends
AI Startup Hits $10K Monthly Revenue
AI project ReelFarm generates viral TikTok videos using templates. Recent success: over $10k MRR within the first month. Case study: an online store achieved 100k+ views without high production costs. Industry trend: growth in accessible, low-cost video creation tools. For aspiring project creators, checklist available.
#AI#Video#Marketing#TikTok#Startup#Viral#MRR#ContentCreation#SocialMedia#Innovation#TechTrends#Entrepreneurship#ReelFarm#DigitalMarketing#BusinessGrowth#MicroSAAS#Entrepreneurs#VideoMarketing#DIY#Creators
Weekend Reading for Entrepreneurs
Explore this week's top news: 1️⃣ Research on mobile game success probability - Read more2️⃣ Tech trends for 2025 according to Andreessen Horowitz - Find out more3️⃣ Video on David Lieb, creator of Google Photos - Watch here4️⃣ Podcast with Vlad Tenev from Robinhood - Listen in5️⃣ David Kahn's AI predictions for 2025 - Read the article6️⃣ Interview with Rocket Lab CEO Peter Beck - Explore the interview7️⃣ Turning mistakes into success with Flamp.io - Learn how
#MobileGames#TechTrends#GooglePhotos#Podcast#AI#RocketLab#StartupSuccess#Sequoia#AndreessenHorowitz#VladTenev#DavidLieb#DavidKahn#PeterBeck#Flamp#YCombinator#SpaceX#Entrepreneurship#Innovation#Research#Investment#Finance