DailyMotion/init_python.sh

31 lines
597 B
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.

#!/usr/bin/env bash
set -euo pipefail
# 1. 切到项目根目录
cd /opt/ql/
apt-get install -y python3-venv
# 2. 创建 virtualenv如果不存在
if [ ! -d daily_com ]; then
echo "创建虚拟环境 daily_com..."
python3 -m venv daily_com
fi
# 3. 激活 venv
# shellcheck disable=SC1091
source daily_com/bin/activate
# 4. 升级 pip
echo "升级 pip..."
pip install --upgrade pip
# 5. 安装依赖
if [ -f requirements.txt ]; then
echo "安装依赖 requirements.txt..."
pip install -r requirements.txt
else
echo "⚠️ 未找到 requirements.txt跳过依赖安装"
fi