Install Prerequisites
Use brew to install python3 and ffmpeg on macOS. 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 command above requires a VPN or proxy 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 one by one:
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 have executed correctly without errors before proceeding.
Download and Unzip the Source Code
Go to https://github.com/jianchang512/pyvideotrans
and download the source code zip package.
Unzip the source code package. You will get a folder named pyvideotrans-main
. Enter this pyvideotrans-main
folder, then find and note its absolute path, for example, /Users/c1/desk/pyvideotrans-main
.
Open a terminal within this folder. Make sure the end of your terminal prompt shows the pyvideotrans-main
directory name. Type ls sp.py
and ensure it outputs sp.py
. If you get a "no such file or directory" error, it means you are not in the correct folder. You must cd
into it.
Create a Virtual Environment with venv and Install Dependencies
In the terminal you opened in the previous step, execute the following commands:
python3.10 -m venv venv
. After it finishes, confirm that avenv
folder has been created in the same directory assp.py
.Then, run the command
source ./venv/bin/activate
.After the commands above are complete, run
python3.10 -m pip install -r requirements.txt
.The installation is now complete. You can start using the software.
How to Run the Software
Each time you want to run the software, you need to open a terminal inside the software's directory. Make sure the prompt ends with the pyvideotrans-main
directory name.
Then, first run the command source ./venv/bin/activate
and confirm that your terminal prompt is prefixed with (venv)
.
After that, run python3.10 sp.py
to launch the software.
If you get a "file not found" error when running source ./venv/bin/activate
, it means your terminal is not in the correct directory. You need to cd
into it.
Note: Only when the terminal prompt is prefixed with (venv)
will the python3.10 sp.py
command run without errors and launch the software correctly.
Troubleshooting
- First, check if your terminal is in the software's source code directory. You can verify this by checking if your command prompt ends with
pyvideotrans-main
. If it doesn't, you must navigate into this directory. - Check if your terminal prompt is prefixed with
(venv)
. If not, the virtual environment is not activated. You need to runsource ./venv/bin/activate
to activate it before runningpython3.10 sp.py
. - Every time you close the terminal or the application and want to run it again, you must first reactivate the virtual environment by running
source ./venv/bin/activate
.