Pre-install Dependencies
On macOS, use brew to install python3 and ffmpeg. If your Mac does not support the brew command, you need to install Homebrew first.
Use this command to install Homebrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
The above command requires a VPN to execute successfully. If it fails, please use the command below:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
Open a terminal and execute the following 3 commands respectively:
brew install [email protected] ln -s /opt/homebrew/opt/[email protected]/bin/python3 /opt/homebrew/bin/python3 ln -s /opt/homebrew/opt/[email protected]/bin/pip3 /opt/homebrew/bin/pip3
brew install ffmpeg
brew install libsndfile
Confirm that all commands are executed correctly without errors before proceeding.
Download and Extract Source Code
Open the website https://github.com/jianchang512/pyvideotrans
to download the source code zip package.
Extract the source code package to get a folder pyvideotrans-main
. Enter this folder pyvideotrans-main
and view and remember the absolute path of the folder, for example, /Users/c1/desk/pyvideotrans-main
.
Open a terminal inside this folder, make sure the end of the terminal line is pyvideotrans-main
, and enter ls sp.py
. Ensure that the output shows the contents of sp.py. If it prompts that the file does not exist or "no such file", it means you are not in this folder, you must cd
into this folder.
Create Virtual Environment with venv Module and Install Dependencies
In the terminal opened in the previous step, execute the command:
python3.10 -m venv venv
. After execution, confirm that avenv
folder has been generated in the same directory as sp.py.Then continue to execute the command
source ./venv/bin/activate
Then execute the following 2 commands respectively, using the Alibaba Cloud mirror to speed up the installation:
python3.10 -m pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
python3.10 -m pip config set install.trusted-host mirrors.aliyun.com
After the above commands are executed, then execute
python3.10 -m pip install -r requirements.txt
At this point, the installation is complete, but there are no models yet. You need to go to
https://github.com/jianchang512/stt/releases/tag/0.0
to download the model and place it correctly according to the instructions before you can use it happily.
How to Open the Software
Each time you open the software, you need to open a terminal in the software directory, making sure the end of the terminal is pyvideotrans-main
.
Then first execute the command source ./venv/bin/activate
. After this command is executed, confirm that the top of the terminal shows (venv)
.
Then execute python3.10 sp.py
to open the software.
If executing source ./venv/bin/activate
prompts that the file does not exist, it means that your terminal is not in this folder, you need to cd into this folder.
Pay attention, when the prompt line of the terminal has the (venv)
character in front, then executing python3.10 sp.py
will not report an error and can correctly open the software.
Encountering Errors
- First check whether the terminal is in the software code folder. The criterion for judgment is whether the terminal command prompt is followed by
pyvideotrans-main
. If not, you must ensure that you are in this folder. - Check whether the prefix of the terminal prompt is
(venv)
. If not, it means that the virtual environment has not been activated. You need to executesource ./venv/bin/activate
and then executepython3.10 sp.py
after activation. - Each time you close the terminal or software, and then want to open the software again, you must execute
source ./venv/bin/activate
to activate the virtual environment.