在 Ubuntu 里**“C++ 环境”通常不是单一软件,而是多个组件的集合。下面按常见情况**给你说明怎么“卸载”。
dpkg -l | grep g++
sudo apt remove g++
sudo apt remove gcc
sudo apt purge g++ gcc
sudo apt autoremove
很多人装 C++ 是通过:
sudo apt install build-essential
卸载方式:
sudo apt remove build-essential
sudo apt autoremove
sudo apt remove cmake make
查看:
ls /usr/bin/g++*
例如有 g++-9 g++-11,可单独卸载:
sudo apt remove g++-9
⚠️ 注意:
apt remove gcc 后还继续 autoremove 到系统组件如果你只是暂时不用,可以:
g++ --version
若提示 command not found 即已卸载。
如果你能告诉我:
我可以给你更精确的卸载方案,避免误删系统依赖。