Files
baijiahao_text_to_image/activate_keyword_crawl_env.sh
shengyudong 97dcff8c8b feat: 添加封面图压字花功能和启动脚本
- 新增封面图本地化压字花处理(深褐色文字+白色描边,居中显示)
- 支持Linux/Windows跨平台字体加载
- 新增启动脚本 start_article_auto_image_matching.sh
- 优化图片生成策略(0张图/1张图/多张图不同处理)
- 绕过网络接口IncompleteRead问题,本地化处理更稳定
- 更新README文档,完善使用说明
2026-02-05 20:25:23 +08:00

41 lines
1.2 KiB
Bash
Raw Permalink 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
# 脚本activate_keyword_crawl_env.sh
# 功能:自动激活 /home/work/keyword_crawl/venv 虚拟环境并执行命令
# 定义虚拟环境路径
VENV_PATH="/home/work/keyword_crawl/venv"
# 检查虚拟环境是否存在
if [ ! -d "$VENV_PATH" ]; then
echo "错误: 虚拟环境不存在: $VENV_PATH"
echo "请确保虚拟环境已正确创建"
exit 1
fi
# 检查虚拟环境中的 Python 解释器
PYTHON_PATH="$VENV_PATH/bin/python"
if [ ! -f "$PYTHON_PATH" ]; then
echo "错误: 在 $VENV_PATH 中找不到 Python 解释器"
exit 1
fi
echo "检测到虚拟环境: $VENV_PATH"
echo "Python 版本: $($PYTHON_PATH --version)"
# 如果提供了命令行参数,则在虚拟环境中执行
if [ $# -gt 0 ]; then
echo "在虚拟环境中执行命令: $*"
"$VENV_PATH/bin/python" "$@"
else
# 否则,仅显示如何手动激活虚拟环境
echo ""
echo "虚拟环境已验证通过!"
echo ""
echo "要手动激活虚拟环境,请运行:"
echo "source $VENV_PATH/bin/activate"
echo ""
echo "或者,您可以直接运行此脚本并附带要执行的 Python 文件:"
echo "./$(basename "$0") script.py"
echo ""
fi