Files
taiko-web/install_tjaf.sh
AnthonyDuan 704d4c7522 fix: 修复 tjaf 依赖安装问题
- 注释掉无法访问的 GitHub 仓库依赖
- 添加 TJAF_INSTALL.md 安装说明文档
- 添加 install_tjaf.sh 自动安装脚本
- 提供多种 tjaf 包安装方案
2025-11-15 16:25:11 +08:00

114 lines
3.2 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# TJAF 安装脚本 - 尝试多种方法安装 tjaf 包
echo "========================================="
echo "TJAF 包安装脚本"
echo "========================================="
echo ""
# 检查是否在虚拟环境中
if [ -z "$VIRTUAL_ENV" ]; then
echo "⚠️ 警告: 未检测到虚拟环境"
echo "建议先激活虚拟环境: source .venv/bin/activate"
echo ""
read -p "是否继续? (y/N) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit 1
fi
fi
# 方法 1: 尝试从 GitHub 镜像站克隆
echo "方法 1: 尝试从 GitHub 镜像站安装..."
echo "----------------------------------------"
# 中国镜像列表
mirrors=(
"https://ghproxy.com/https://github.com/yuukiwww/tjaf.git"
"https://github.moeyy.xyz/https://github.com/yuukiwww/tjaf.git"
"https://mirror.ghproxy.com/https://github.com/yuukiwww/tjaf.git"
)
for mirror in "${mirrors[@]}"; do
echo "尝试: $mirror"
if pip install "git+${mirror}@d59e854b074012f6a31bd4c65b53edb6148b0ac7" 2>/dev/null; then
echo "✅ 安装成功!"
exit 0
fi
done
echo "❌ 镜像站方法失败"
echo ""
# 方法 2: 检查是否有本地缓存
echo "方法 2: 检查本地 pip 缓存..."
echo "----------------------------------------"
if pip show tjaf &>/dev/null; then
echo "✅ tjaf 已安装!"
pip show tjaf
exit 0
fi
echo "❌ 本地未找到 tjaf 包"
echo ""
# 方法 3: 尝试从本地目录安装
echo "方法 3: 检查本地 tjaf 目录..."
echo "----------------------------------------"
if [ -d "tjaf" ] || [ -d "../tjaf" ]; then
echo "找到本地 tjaf 目录,尝试安装..."
if [ -d "tjaf" ]; then
pip install -e ./tjaf && echo "✅ 从本地安装成功!" && exit 0
elif [ -d "../tjaf" ]; then
pip install -e ../tjaf && echo "✅ 从本地安装成功!" && exit 0
fi
fi
echo "❌ 未找到本地 tjaf 目录"
echo ""
# 方法 4: 提供手动安装说明
echo "========================================="
echo "自动安装失败,请尝试手动安装"
echo "========================================="
echo ""
echo "选项 A: 从其他已安装环境复制"
echo "----------------------------------------"
echo "1. 在已安装 tjaf 的环境中执行:"
echo " pip freeze | grep tjaf"
echo " pip wheel tjaf -w ./wheels"
echo ""
echo "2. 复制 wheels 目录到当前服务器"
echo ""
echo "3. 在当前环境安装:"
echo " pip install ./wheels/tjaf-*.whl"
echo ""
echo ""
echo "选项 B: 使用本地源代码"
echo "----------------------------------------"
echo "1. 获取 tjaf 源代码(从备份或其他来源)"
echo ""
echo "2. 放置到项目目录:"
echo " mkdir -p tjaf"
echo " # 复制源代码到 tjaf/ 目录"
echo ""
echo "3. 安装:"
echo " pip install -e ./tjaf"
echo ""
echo ""
echo "选项 C: 跳过 tjaf测试模式"
echo "----------------------------------------"
echo "如果暂时不需要 TJA 解析功能,可以:"
echo "1. 安装其他依赖:"
echo " pip install -r requirements.txt"
echo ""
echo "2. 注释掉 app.py 中的 tjaf 相关代码"
echo ""
echo ""
echo "需要更多帮助? 查看 TJAF_INSTALL.md"
echo "========================================="
exit 1