🔧 主要修复: 1. 命令行参数修复: - 自动提供 --output 参数,避免 'requires --output' 错误 - Windows: 默认使用 C:\temp - Linux/macOS: 默认使用 /tmp - 支持用户自定义输出路径 2. 依赖处理优化: - 云存储模块优雅降级,无 qcloud_cos 时使用本地文件 - 添加 cos_available 标志位 - 本地文件使用 file:// URL 格式 - API 客户端检测并提示本地文件不支持 3. 安装工具: - 新增 install_ai_video_deps.py 依赖安装脚本 - 自动检测和安装缺失的包 - 验证模块导入功能 ✅ 修复效果: - 解决 'Single mode requires --output' 错误 ✓ - 消除 qcloud_cos 警告影响 ✓ - 提供完整的依赖管理方案 ✓ - 支持本地文件处理模式 ✓ 📊 当前状态: - 路径问题:已解决 ✓ - 参数问题:已解决 ✓ - 依赖问题:已解决 ✓ - API 通信:正常 ✓ - 任务提交:成功 ✓ - 执行状态:需要进一步调试 API 服务端问题 现在 AI 视频生成的基础架构已完全正常,剩余问题集中在 API 服务端处理!
73 lines
2.1 KiB
Python
73 lines
2.1 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Install AI Video Dependencies
|
|
安装 AI 视频生成所需的依赖包
|
|
"""
|
|
|
|
import subprocess
|
|
import sys
|
|
import os
|
|
|
|
def install_package(package_name, import_name=None):
|
|
"""Install a Python package using pip"""
|
|
if import_name is None:
|
|
import_name = package_name
|
|
|
|
try:
|
|
__import__(import_name)
|
|
print(f"✅ {package_name} is already installed")
|
|
return True
|
|
except ImportError:
|
|
print(f"📦 Installing {package_name}...")
|
|
try:
|
|
subprocess.check_call([sys.executable, "-m", "pip", "install", package_name])
|
|
print(f"✅ {package_name} installed successfully")
|
|
return True
|
|
except subprocess.CalledProcessError as e:
|
|
print(f"❌ Failed to install {package_name}: {e}")
|
|
return False
|
|
|
|
def main():
|
|
"""Main installation function"""
|
|
print("🚀 Installing AI Video Dependencies...")
|
|
print("=" * 50)
|
|
|
|
# List of required packages
|
|
packages = [
|
|
("requests", "requests"),
|
|
("cos-python-sdk-v5", "qcloud_cos"),
|
|
("loguru", "loguru"),
|
|
]
|
|
|
|
success_count = 0
|
|
total_count = len(packages)
|
|
|
|
for package_name, import_name in packages:
|
|
if install_package(package_name, import_name):
|
|
success_count += 1
|
|
|
|
print("=" * 50)
|
|
print(f"📊 Installation Summary: {success_count}/{total_count} packages installed")
|
|
|
|
if success_count == total_count:
|
|
print("🎉 All dependencies installed successfully!")
|
|
|
|
# Test AI video module import
|
|
print("\n🧪 Testing AI video module import...")
|
|
try:
|
|
sys.path.append('python_core')
|
|
from ai_video import VideoGenerator
|
|
print("✅ AI video module imported successfully!")
|
|
except Exception as e:
|
|
print(f"❌ AI video module import failed: {e}")
|
|
return False
|
|
|
|
return True
|
|
else:
|
|
print("❌ Some dependencies failed to install. Please check the errors above.")
|
|
return False
|
|
|
|
if __name__ == "__main__":
|
|
success = main()
|
|
sys.exit(0 if success else 1)
|