Skip to content

Pre-install Dependencies

Open a terminal and execute the following 3 commands:

  1. brew install [email protected]

  2. brew install ffmpeg

  3. 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:

  1. python3.10 -m venv venv. After execution, confirm that the venv folder is generated in the same directory as sp.py.

  2. Then execute the command source ./venv/bin/activate.

  3. 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
  1. After executing the above commands, execute pip3 install -r requirements.txt.

  2. 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

  1. 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.
  2. Check if the terminal prompt prefix is (venv). If not, it means the virtual environment is not activated. You need to execute source ./venv/bin/activate to activate it, then execute python3 sp.py.
  3. 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.