Pre-install Dependencies
Open a terminal and execute the following 3 commands:
brew install [email protected]
brew install ffmpeg
brew install libsndfile
Make sure all commands execute correctly without errors, then proceed.
Download and Unzip Source Code
Open the URL https://github.com/jianchang512/pyvideotrans as shown in the figure below to download the source code zip package.
Unzip the source code package to get a folder pyvideotrans-main
. Enter the pyvideotrans-main
folder and note its absolute path, for example, /Users/c1/desk/pyvideotrans-main
. The file list in this folder should be similar to the image below.
Open a terminal in this folder. Ensure that the end of the terminal line displays pyvideotrans-main
. Input ls sp.py
. Ensure that sp.py
is outputted. If it indicates that the file does not exist or shows "no such file", it means you are not in the correct folder. You must use cd
to enter the folder.
Create Virtual Environment and Install Dependencies using venv
In the terminal opened in the previous step, execute the following commands:
python3.10 -m venv venv
. After execution, confirm that thevenv
folder is generated in the same directory assp.py
.Then execute the command
source ./venv/bin/activate
.Then execute the following 2 commands using the Alibaba Cloud mirror to speed up the installation:
pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple/
pip3 config set install.trusted-host mirrors.aliyun.com
After executing the above commands, execute
pip3 install -r requirements.txt
.At this point, the installation is complete, but there are no models yet. You need to download the model from https://github.com/jianchang512/stt/releases/tag/0.0 and place it correctly according to the instructions before you can use it.
How to Open the Software
Each time you open the software, you need to open a terminal in the software directory and ensure that the terminal ends with pyvideotrans-main
.
Then execute the command source ./venv/bin/activate
first.
Then execute python3 sp.py
to open the software.
If executing source ./venv/bin/activate
prompts that the file does not exist, it means your terminal is not in the correct folder. You need to cd
into the folder.
Note that when the terminal prompt starts with (venv)
, executing python3 sp.py
will not result in an error and the software will open correctly.
Troubleshooting
- First, check if the terminal is in the software code folder. The criterion is whether the terminal command prompt ends with
pyvideotrans-main
. If not, ensure that you are in the correct folder. - Check if the terminal prompt prefix is
(venv)
. If not, it means the virtual environment is not activated. You need to executesource ./venv/bin/activate
to activate it, then executepython3 sp.py
. - Every time you close the terminal or software, and want to open the software again, you must execute
source ./venv/bin/activate
to activate the virtual environment.