📋 环境要求
| 依赖 | 版本要求 | 说明 |
|---|---|---|
| Python | 3.10+ | 推荐 3.11 |
| Ollama | 最新版 | 本地 LLM 运行环境 |
| ImageMagick | 7.x | 图片处理 |
| FFmpeg | 4.x+ | 视频编码 |
| PostgreSQL | 14+ | 任务队列数据库 |
硬件要求
- CPU:4 核以上
- 内存:8GB 以上(运行 Ollama 模型需要)
- 硬盘:10GB 以上可用空间
- GPU:可选,用于加速本地模型推理
🔧 安装步骤
1. 安装 Ollama
bash
# macOS / Linux
curl -fsSL https://ollama.ai/install.sh | sh
# 启动 Ollama 服务
ollama serve
# 拉取模型(推荐 llama3.1:8b)
ollama pull llama3.1:8b
2. 安装 ImageMagick
bash
# macOS
brew install imagemagick
# Ubuntu / Debian
sudo apt-get install imagemagick
# Windows
# 下载安装包: https://imagemagick.org/script/download.php
3. 安装 FFmpeg
bash
# macOS
brew install ffmpeg
# Ubuntu / Debian
sudo apt-get install ffmpeg
# Windows
# 下载安装包: https://ffmpeg.org/download.html
4. 克隆并安装项目
bash
# 克隆仓库
git clone https://github.com/fujiwarachoki/moneyprinter.git
cd moneyprinter
# 运行自动安装脚本
./setup.sh
# 或手动安装
pip install -r requirements.txt
5. 配置环境变量
bash
# 复制配置模板
cp .env.example .env
# 编辑配置文件
nano .env
🚀 启动服务
启动后端 API
bash
# 启动 PostgreSQL(如果使用 Docker)
docker-compose up -d postgres
# 启动后端服务
python -m uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000
启动前端界面
bash
cd frontend
npm install
npm run dev
访问 http://localhost:3000 打开 Web 界面。
🎬 创建第一个视频
- 打开 Web 界面
- 点击「新建任务」
- 输入视频主题,如:
人工智能的未来发展趋势 - 选择视频时长(建议 30-60 秒)
- 选择 Ollama 模型
- 点击「生成」按钮
- 等待任务完成,预览并下载视频
💡 提示
首次生成可能需要下载模型和素材,请耐心等待。后续生成会更快。
⚙️ 常用命令
bash
# 查看 Ollama 模型列表
ollama list
# 拉取新模型
ollama pull mistral:7b
# 查看任务队列
python -m backend.cli tasks
# 运行测试
pytest tests/
# 查看 API 文档
# 访问 http://localhost:8000/docs