Skip to content

Pre-install Dependencies

Use brew to install python3 and ffmpeg on MacOS. If your Mac doesn't support the brew command, install Homebrew first.

Install Homebrew with this command: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

The above command requires internet access to execute successfully. If it fails, 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 three commands:

  1. 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
  2. brew install ffmpeg

  3. brew install libsndfile

Ensure all commands execute correctly without errors before proceeding.

Download and Extract the Source Code

Visit https://github.com/jianchang512/pyvideotrans to download the source code ZIP file.

Extract the ZIP file to get a folder named pyvideotrans-main. Navigate into this folder and note its absolute path, e.g., /Users/c1/desk/pyvideotrans-main.

Open a terminal inside this folder. Ensure the terminal prompt ends with pyvideotrans-main. Type ls sp.py to confirm it outputs the file content. If it shows "no such file," you are not in the correct folder and must cd into it.

Create a Virtual Environment with venv and Install Dependencies

In the terminal opened in the previous step, execute the following commands:

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

  2. Then execute: source ./venv/bin/activate

  3. Next, run the following two commands to use Alibaba Cloud mirrors for faster 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
  1. After the above commands complete, execute: python3.10 -m pip install -r requirements.txt

  2. The installation is now complete, and you can start using the software.

How to Open the Software

Each time you want to open the software, open a terminal inside the software directory and ensure the prompt ends with pyvideotrans-main.

Then, execute source ./venv/bin/activate and confirm the terminal prompt starts with (venv).

Finally, run python3.10 sp.py to launch the software.

If source ./venv/bin/activate returns "file not found," you are not in the correct folder and must cd into it.

Note: Only when the terminal prompt begins with (venv) will python3.10 sp.py execute without errors and open the software correctly.

Troubleshooting Errors

  1. First, check if the terminal is inside the software code folder. The prompt should end with pyvideotrans-main. If not, ensure you are in the correct folder.
  2. Check if the terminal prompt starts with (venv). If not, the virtual environment is not activated. Execute source ./venv/bin/activate, then run python3.10 sp.py.
  3. Every time you close the terminal or software, you must reactivate the virtual environment with source ./venv/bin/activate before reopening the software.