vim ~/.bash_profile 在文件中追加如下几行: alias gcc=‘gcc-7’ alias g++=‘g+±7’ alias c++=‘c+±7’ 然后运行命令:source ~/.bash_profile