运行命令 vi /etc/profile 在文件的最后添加上: export PATH="/你要的目录:$PATH" 保存和退出 最重要的是下面这步,运行命令 source /etc/profile 没报错则成功。