Skip to main content التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
يتجاوز الأمر المباشر Prompt المخصّص للمراجعة. افحص المصدر قبل تشغيله.
npx skills add https://github.com/Wike-CHI/acquisition-agent --skill acquisition-dependenciesيبقى الأمر في سطر واحد. مرّر أفقيًا لمراجعته كاملًا قبل النسخ.
تفضّل نسخة محلية؟ نزّل الملفات المتاحة حاليًا لدى SkillsMP.
المهن ذات الصلةSOC
استنادا إلى تصنيف SOC المهني
| name | acquisition-dependencies |
| version | 2.0.0 |
| description | 红龙获客系统依赖安装技能 v2.0 - 跨平台自动检测+安装。自动识别 Linux/Windows/macOS 环境,安装所有 Python/npm 系统依赖。触发:安装依赖、更新依赖、补全依赖、一键安装依赖。 |
| triggers | ["安装依赖","更新依赖","补全依赖","安装依赖包","修复依赖","一键安装依赖","初始化环境"] |
红龙获客系统 · 依赖安装技能 v2.0
Skill Graph: 领域 → [[_index-meta|系统元技能领域]] | 上游 ← [[_index-acquisition|核心流程领域]] | 下游 → [[acquisition-init|系统初始化]](依赖安装后)
功能
自动检测当前系统环境(Linux/Windows/macOS/WSL2),根据检测结果安装所有必需的 Python 和 npm 依赖。
一键安装
bash ~/.hermes/skills/acquisition/acquisition-dependencies/scripts/install-deps.sh
powershell -ExecutionPolicy Bypass -File "$env:USERPROFILE\.hermes\skills\acquisition\acquisition-dependencies\scripts\install-deps.ps1"
离线环境下直接运行本地脚本即可(脚本已安装在 skills/ 目录内,无需联网)。
环境检测逻辑
检测顺序:
1. uname -s → 判断 Linux/Darwin/NT
2. /proc/version → 判断 WSL2
3. command -v node/npm/python3 → 判断已安装的工具
| 检测结果 | 系统类型 | 安装方式 |
|---|
| Linux + /proc/version含microsoft | WSL2 | apt-get + node symlink修复 |
| Linux + 无WSL特征 | Debian/Ubuntu | apt-get |
| Darwin | macOS | brew |
| NT/CYGWIN/MINGW | Windows | PowerShell + pip |
陷阱记录
- 不要依赖远程curl安装:GitHubraw可能不通,脚本必须已在本地 skills/ 目录内
- WSL2 node路径问题:WSL2下node可能在~/.nvm/,需要symlink到/usr/bin/否则子进程找不到
- pip3 --user vs sudo apt:apt的python包版本可能旧,pip3 --user补充安装确保最新版
- Playwright Chromium体积大:180MB,首次安装用tail -5避免长时间无输出
- patch误删风险:修改RETAINED_SKILLS清单时易漏掉整块技能组(如CRM/工具层),修复后需重新验证清单数量与目录一致
依赖清单
Python 依赖(所有平台)
| 包名 | 用途 | 验证命令 |
|---|
| openpyxl | Excel读写 | python3 -c "import openpyxl" |
| docx | Word读写 | python3 -c "import docx" |
| yaml | YAML解析 | python3 -c "import yaml" |
| Pillow | 图片处理 | python3 -c "from PIL import Image" |
| requests | HTTP请求 | python3 -c "import requests" |
| regex | 正则增强 | python3 -c "import regex" |
| lxml | XML/HTML解析 | python3 -c "import lxml" |
| playwright | 浏览器自动化 | python3 -c "from playwright.sync_api import sync_playwright" |
Node.js 依赖(所有平台)
| 包名 | 用途 | 验证命令 |
|---|
| nodemailer | 邮件发送 | node -e "require('nodemailer')" |
浏览器(可选)
| 浏览器 | 用途 | 安装命令 |
|---|
| Chromium | Playwright主力 | python3 -m playwright install chromium |
| Chrome | 备用 | python3 -m playwright install chrome |
安装脚本
Linux/macOS: install-deps.sh
#!/usr/bin/env bash
set -euo pipefail
RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'
CYAN='\033[0;36m'; BOLD='\033[1m'; NC='\033[0m'
log() { echo -e "${CYAN}[$(date '+%H:%M:%S')]${NC} $*"; }
ok() { echo -e "${GREEN} ✓${NC} $*"; }
warn() { echo -e "${YELLOW} ⚠${NC} $*"; }
fail() { echo -e "${RED} ✗${NC} $*"; }
detect_os() {
local os_type
case "$(uname -s)" in
Linux*) os_type="linux" ;;
Darwin*) os_type="macos" ;;
CYGWIN*|MINGW*|MSYS*|NT*) os_type="windows" ;;
*) os_type="unknown" ;;
esac
[[ == ]] && grep -qi /proc/version 2>/dev/null;
os_type=
}
() {
-v node &>/dev/null;
-v npm &>/dev/null;
-v python3 &>/dev/null;
-v python &>/dev/null;
}
() {
python3 -c 2>/dev/null
}
() {
node -e 2>/dev/null
}
() {
-v apt-get &>/dev/null;
apt-get update -qq
pkgs=(
python3-pip
python3-openpyxl
python3-docx
python3-yaml
python3-pil
python3-requests
python3-regex
python3-lxml
)
apt-get install -y 2>&1 | -5
ok
warn
pip3 install --quiet --user openpyxl docx pyyaml Pillow requests regex lxml 2>&1 | -3
ok
}
() {
! -v brew &>/dev/null;
fail
1
brew install python3 node
brew install python3-openpyxl python3-docx python3-yaml python3-pillow 2>/dev/null ||
ok
}
() {
python_pkgs=
failed=()
pkg ;
python3 -c 2>/dev/null;
-n
pip3 install --quiet --user 2>/dev/null;
ok
fail
failed+=()
python3 -c 2>/dev/null;
ok
pip3 install --quiet playwright 2>&1 | -2
python3 -m playwright install chromium --with-deps 2>&1 | -5
ok
[[ -gt 0 ]];
warn
1
0
}
() {
! -v npm &>/dev/null;
warn
0
npm_pkgs=
failed=()
pkg ;
node -e 2>/dev/null;
ok
npm install -g 2>/dev/null;
ok
fail
failed+=()
[[ -gt 0 ]];
warn
}
() {
node_path
[[ -d ]];
node_version
node_version=$( | -1)
[[ -n ]];
nvm_node=
nvm_npm=
[[ ! -L /usr/bin/node ]] && [[ -f ]];
-sf /usr/bin/node
-sf /usr/bin/npm
ok
}
() {
failed=0
py_pkgs=
pkg ;
import_name=
python3 -c 2>/dev/null;
ok
fail
((failed++))
python3 -c 2>/dev/null;
ok
fail
((failed++))
node -e 2>/dev/null;
ok
warn
}
() {
os_type
os_type=$(detect_os)
detect_node | -r line;
linux|wsl2)
install_linux
[[ == ]];
install_wsl2_extras
;;
macos)
install_macos
;;
windows)
fail
1
;;
*)
fail
1
;;
install_python_deps
install_npm_deps
verify_all;
ok
warn
1
}
main
详细参考
以下内容已拆分到 [[references/windows-install.md]],仅在需要时读取:
Windows PowerShell 安装脚本、集成说明和版本历史。
if
"$os_type"
"linux"
'microsoft\|wsl'
then
"wsl2"
fi
echo
"$os_type"
detect_node
if
command
then
echo
"node: $(node --version)"
else
echo
"node: NOT FOUND"
fi
if
command
then
echo
"npm: $(npm --version)"
else
echo
"npm: NOT FOUND"
fi
if
command
then
echo
"python3: $(python3 --version 2>&1)"
elif
command
then
echo
"python: $(python --version 2>&1)"
else
echo
"python3: NOT FOUND"
fi
check_python_pkg
"import $1"
check_npm_pkg
"require('$1')"
install_linux
log
"${BOLD}==> Linux/WSL2 环境${NC}"
if
command
then
log
"检测到 apt 包管理器"
sudo
local
log
"安装 Python 系统包..."
sudo
"${pkgs[@]}"
tail
"系统包安装完成"
else
"apt 不可用,尝试 pip3 直接安装..."
fi
log
"使用 pip3 补充/升级包..."
tail
"pip3 安装完成"
install_macos
log
"${BOLD}==> macOS 环境${NC}"
if
command
then
"Homebrew 未安装,请先安装: /bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""
return
fi
log
"安装 Homebrew 包..."
true
"Homebrew 安装完成"
install_python_deps
log
"${BOLD}==> 安装 Python 依赖${NC}"
local
"openpyxl docx pyyaml Pillow requests regex lxml"
local
for
in
$python_pkgs
do
if
"import ${pkg%%:*}"
then
echo
""
else
if
"$pkg"
then
"$pkg"
else
"$pkg 安装失败"
"$pkg"
fi
fi
done
if
"from playwright.sync_api import sync_playwright"
then
"playwright 已安装"
else
log
"安装 Playwright..."
tail
tail
"playwright + chromium 安装完成"
fi
if
${#failed[@]}
then
"以下包安装失败: ${failed[*]}"
return
fi
return
install_npm_deps
log
"${BOLD}==> 安装 Node.js 依赖${NC}"
if
command
then
"npm 未安装,跳过 Node.js 依赖"
return
fi
local
"nodemailer"
local
for
in
$npm_pkgs
do
if
"require('$pkg')"
then
"$pkg 已安装"
else
if
"$pkg"
then
"$pkg"
else
"$pkg 安装失败"
"$pkg"
fi
fi
done
if
${#failed[@]}
then
"以下包安装失败: ${failed[*]}"
fi
install_wsl2_extras
log
"${BOLD}==> WSL2 特殊处理${NC}"
local
if
"$HOME/.nvm/versions/node"
then
local
ls
"$HOME/.nvm/versions/node"
head
if
"$node_version"
then
local
"$HOME/.nvm/versions/node/$node_version/bin/node"
local
"$HOME/.nvm/versions/node/$node_version/bin/npm"
if
"$nvm_node"
then
sudo
ln
"$nvm_node"
sudo
ln
"$nvm_npm"
"node/npm symlink 已创建 → $node_version"
fi
fi
fi
verify_all
log
"${BOLD}==> 验证安装${NC}"
local
local
"openpyxl docx yaml PIL requests regex lxml"
for
in
$py_pkgs
do
local
"${pkg%%:*}"
if
"import $import_name"
then
"python: $pkg"
else
"python: $pkg MISSING"
fi
done
if
"from playwright.sync_api import sync_playwright"
then
"python: playwright"
else
"python: playwright MISSING"
fi
if
"require('nodemailer')"
then
"node: nodemailer"
else
"node: nodemailer 未安装 (可选)"
fi
return
$failed
main
echo
""
echo
"═══════════════════════════════════════════════════"
echo
" 红龙获客系统 · 依赖安装 v2.0"
echo
"═══════════════════════════════════════════════════"
echo
""
local
log
"系统检测:"
while
read
do
echo
" $line"
done
echo
" OS类型: $os_type"
echo
""
case
"$os_type"
in
if
"$os_type"
"wsl2"
then
fi
"Windows 原生环境请使用 PowerShell 脚本: install-deps.ps1"
return
"无法识别的系统: $(uname -a)"
return
esac
echo
""
if
then
echo
""
"全部依赖安装成功!"
echo
""
else
echo
""
"部分依赖安装失败,请参考上方错误信息"
return
fi
"$@"