MacOS源码部署
打开终端窗口,分别执行如下命令
执行前确保已安装 Homebrew,如果你没有安装 Homebrew,那么需要先安装
执行命令安装 Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
安装完成后,执行:
eval $(brew --config)
brew install libsndfile brew install ffmpeg brew install git brew install [email protected]
继续执行
export PATH="/usr/local/opt/[email protected]/bin:$PATH" source ~/.bash_profile source ~/.zshrc
创建不含空格和中文的文件夹,在终端中进入该文件夹。
终端中执行命令
git clone https://github.com/jianchang512/pyvideotrans
执行命令
cd pyvideotrans
继续执行
python -m venv venv
继续执行命令
source ./venv/bin/activate
,执行完毕查看确认终端命令提示符已变成已(venv)
开头,以下命令必须确定终端提示符是以(venv)
开头执行
pip install -r requirements.txt --no-deps
,如果提示失败,执行如下2条命令切换pip镜像到阿里镜像pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ pip config set install.trusted-host mirrors.aliyun.com
然后重新执行 如果已切换到阿里镜像源,仍提示失败,请尝试执行
pip install -r requirements.txt --ignore-installed --no-deps
python sp.py
打开软件界面
Linux 源码部署
- CentOS/RHEL系依次执行如下命令安装 python3.12
sudo yum update
sudo yum groupinstall "Development Tools"
sudo yum install openssl-devel bzip2-devel libffi-devel
cd /tmp
wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz
tar xzf Python-3.12.0.tgz
cd Python-3.12.0
./configure — enable-optimizations
sudo make && sudo make install
sudo alternatives — install /usr/bin/python3 python3 /usr/local/bin/python3.12 2
sudo yum install -y ffmpeg
- Ubuntu/Debian系执行如下命令安装python3.12
apt update && apt upgrade -y
apt install software-properties-common -y
add-apt-repository ppa:deadsnakes/ppa
apt update
sudo apt-get install libxcb-cursor0
apt install python3.12
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12
pip 23.2.1 from /usr/local/lib/python3.12/site-packages/pip (python 3.12)
sudo update-alternatives --install /usr/bin/python python /usr/local/bin/python3.12 1
sudo update-alternatives --config python
apt-get install ffmpeg
打开任意一个终端,执行 python3 -V
,如果显示 “3.12.0”,说明安装成功,否则失败
创建个不含空格和中文的文件夹, 从终端打开该文件夹。
终端中执行命令
git clone https://github.com/jianchang512/pyvideotrans
继续执行命令
cd pyvideotrans
继续执行
python -m venv venv
继续执行命令
source ./venv/bin/activate
,执行完毕查看确认终端命令提示符已变成已(venv)
开头,以下命令必须确定终端提示符是以(venv)
开头执行
pip install -r requirements.txt --no-deps
,如果提示失败,执行如下2条命令切换pip镜像到阿里镜像pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ pip config set install.trusted-host mirrors.aliyun.com
然后重新执行,如果已切换到阿里镜像源,仍提示失败,请尝试执行
pip install -r requirements.txt --ignore-installed --no-deps
如果要使用CUDA加速,分别执行
pip uninstall -y torch torchaudio
pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install nvidia-cublas-cu11 nvidia-cudnn-cu11
linux 如果要启用cuda加速,必须有英伟达显卡,并且配置好了CUDA11.8+环境,请自行搜索 "Linux CUDA 安装"
python sp.py
打开软件界面
Window10/11 源码部署
打开 https://www.python.org/downloads/ 下载 windows3.12,下载后双击,一路next,注意要选中“Add to PATH”
打开一个cmd,执行
python -V
,如果输出不是3.12.3
,说明安装出错,或没有加入Add to PATH
,请重新安装打开 https://github.com/git-for-windows/git/releases/download/v2.45.0.windows.1/Git-2.45.0-64-bit.exe ,下载git,下载后双击一路下一步。
找个不含空格和中文的文件夹,地址栏中输入
cmd
回车,打开终端,以下命令均在该终端中执行执行命令
git clone https://github.com/jianchang512/pyvideotrans
继续执行命令
cd pyvideotrans
继续执行
python -m venv venv
继续执行命令
.\venv\scripts\activate
,执行后请查看确认命令行开头已变成了(venv)
,否则说明出错执行
pip install -r requirements.txt --no-deps
,如果提示失败,执行如下2条命令切换pip镜像到阿里镜像pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ pip config set install.trusted-host mirrors.aliyun.com
然后重新执行,如果已切换到阿里镜像源,仍提示失败,请尝试执行
pip install -r requirements.txt --ignore-installed --no-deps
如果要使用CUDA加速,分别执行
pip uninstall -y torch torchaudio
pip install torch torchaudio --index-url https://download.pytorch.org/whl/cu118
windows 如果要启用cuda加速,必须有英伟达显卡,并且配置好了CUDA11.8+环境,具体安装见 CUDA加速支持
解压 ffmpeg.zip 到当前源码目录下,提示覆盖则覆盖,解压后确保源码下的ffmepg文件夹内能看到 ffmpeg.exe ffprobe.exe ytwin32.exe,
python sp.py
打开软件界面
源码部署问题说明
- 默认使用 ctranslate2的4.x版本,仅支持CUDA12.x版本,如果你的cuda低于12,并且无法升级cuda到12.x,请执行命令卸载ctranslate2然后重新安装
pip uninstall -y ctranslate2
pip install ctranslate2==3.24.0
- 可能会遇到
xx module not found
之类错误,请打开 requirements.txt,搜索该 xx 模块,然后将xx后的 ==及等会后的版本号去掉