我下载了 ffmpeg 的 zip,因为 brew 安装与 macOS High Sierra 10.13.6 不兼容。解压后只包含ffmpeg文件,其图标类似于终端的图标。我想让终端(运行 bin/bash $SHELL)永久识别 ffmpeg
命令。
如果我输入:
echo export PATH="/Users/imac/Documents/ffmpeg:$PATH" > ~/.bashrc
source ~/.bashrc
ffmpeg
然后命令 ffmpeg
被识别,所以一切正常。 但是,如果我退出终端并重新打开它,或者只是重新启动计算机
ffmpeg
作为输出 -bash: ffmpeg: command not found
.因此,我必须每次执行上述步骤 1 和 2。cat .bashrc
的输出:export PATH=/Users/imac/Documents/ffmpeg:/Library/Frameworks/Python.framework/Versions/3.9/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/anaconda3/condabin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin
echo $PATH
的输出:/Library/Frameworks/Python.framework/Versions/3.9/bin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/opt/anaconda3/condabin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin
备注 在步骤 4
ffmpeg
出现(在我存储的位置),而在步骤 5 ffmpeg
缺席。此外,我对 bash 和终端知之甚少,所以如果可以,请在答案和/或评论中进行解释。非常感谢!
最佳答案
按着这些次序:
cd ~; nano .bash_profile
export PATH="<Replace with the path>:$PATH"
注:
<...>
被替换例如。对我来说是:
export PATH="/Users/imac/Documents/ffmpeg:$PATH"
关于bash - 如何在 macOS 中永久使 ffmpeg 可从 bin/bash 中识别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71757711/