Skip to content

Pre-Installation Dependencies

On MacOS, use brew to install python3 and ffmpeg. If the brew command is not supported on your Mac, 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 stable internet connection. If it fails, use the following command instead:

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

Open a terminal and execute the following 3 commands respectively:

  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

Make sure that all commands are executed correctly without any errors before proceeding.

Download and Extract Source Code

Open the website https://github.com/jianchang512/pyvideotrans and download the source code zip package.

Extract the source code package to get a folder named pyvideotrans-main. Enter this folder pyvideotrans-main and view and remember the absolute path of the folder, such as /Users/c1/desk/pyvideotrans-main.

Open a terminal within this folder, making sure that the end of the terminal line is pyvideotrans-main. Enter ls sp.py and make sure that the output shows the contents of sp.py. If it says that the file does not exist or no such file, it means that you are not in the correct folder, and you must cd into this folder.

Create a Virtual Environment and Install Dependencies using the venv Module

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 has been generated in the same directory as sp.py.

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

  3. Then execute the following 2 commands to use 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
  1. After the above commands are executed, execute python3.10 -m pip install -r requirements.txt

  2. Installation is now complete and you can use the software.

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 source ./venv/bin/activate command, and confirm that the header of the terminal is (venv).

Then execute python3.10 sp.py to open the software.

If executing source ./venv/bin/activate indicates that the file does not exist, it means that your terminal is not in this folder, and you need to cd into this folder.

Note that when the prompt line of the terminal has the (venv) character at the beginning, executing python3.10 sp.py at this time will not report an error and can correctly open the software.

Troubleshooting

  1. First check whether the terminal is in the software code folder. The standard for judgment is whether pyvideotrans-main is after the terminal command prompt. If not, you must make sure that you are in this folder.
  2. Check whether the terminal prompt prefix is (venv). If not, it means that the virtual environment is not activated. You need to execute source ./venv/bin/activate to activate it and then execute python3.10 sp.py
  3. Each time after closing the terminal or software, if you want to open the software again, you must execute source ./venv/bin/activate to activate the virtual environment.