Windows怎样安装GeneFace++

AI技术
小华
2026-11-02

下面按照在 Windows 上安装并运行 GeneFace++(GitHub: Tony-Nemo/GeneFacePlusPlus)的常见流程给你一份实用指南。GeneFace++ 官方主要面向 Linux,但 Windows 是可以跑的,只是坑比较多,我会标出重点注意事项。

一、准备工作

1. 系统要求

  • Windows 10 / 11(推荐 11)
  • NVIDIA 显卡(CUDA 支持,>= 8G 显存更稳)
  • 已安装:
  • Git
  • Python 3.8 / 3.9(非常重要,不要用 3.10+)
  • CUDA + cuDNN(与 PyTorch 版本匹配)

二、安装步骤

1. 克隆仓库

git clone https://github.com/Tony-Nemo/GeneFacePlusPlus.git
cd GeneFacePlusPlus

2. 创建虚拟环境(推荐)

conda create -n geneface python=3.9
conda activate geneface

或使用 venv:

python -m venv venv
venv\Scripts\activate

3. 安装 PyTorch(Windows 关键一步)

不要用仓库默认命令,先手动装:

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

(CUDA 11.8 示例,按你显卡驱动调整)

4. 安装依赖

pip install -r requirements.txt

⚠️ Windows 常见问题:

  • numba 可能需要:
conda install numba
  • pyrender Windows 基本不可用(需要 OpenGL)
  • 解决:用 WSL2 或注释掉相关代码
  • face_alignment 可能报错,建议:
pip install face-alignment==1.3.5

5. 安装视觉/音频相关库

pip install librosa soundfile imageio imageio-ffmpeg

三、下载预训练模型

官方文档:

bash scripts/download_pretrained.sh

❌ Windows 不能直接跑 bash
手动操作:

  1. 打开仓库 README
  2. 下载:
  • genefaceplusplus.pth
  • 其他 checkpoint
  1. 放到:
checkpoints/

四、运行示例(Windows 修正版)

推理命令(示例)

python inference/genefacepp_inference.py \
--a audio.wav \
--r reference.jpg \
--o output.mp4

如果报错:

  • No module named 'pyrender' → 注释掉
  • GL context 错误 → 用 WSL2

五、强烈推荐的 Windows 方案(省坑)

✅ 方案 A:WSL2(最稳)

wsl --install

在 Ubuntu 里照 Linux 教程走,成功率 90%+

✅ 方案 B:Docker(进阶)

官方有 Dockerfile,但 Windows 下需要:

  • WSL2 后端
  • NVIDIA Container Toolkit

六、常见报错速查

问题解决
Python 版本错误用 3.9
CUDA 不匹配重装 PyTorch
pyrender 报错用 WSL2
ffmpeg 找不到装 ffmpeg 并加 PATH

七、总结建议

✅ 能跑,但不适合纯 Windows 新手
✅ 最稳:Windows + WSL2 + Ubuntu
✅ 显存不够会很慢
如果你愿意,我可以:

  • 给你 一步步 WSL2 安装教程
  • 或 直接帮你改 Windows 可运行推理脚本

你现在是 纯 Windows 还是愿意用 WSL?

亿速云提供售前/售后服务

售前业务咨询

售后技术保障

400-100-2938

7*24小时售后电话

官方微信小程序