1、卸載低版本
先查看是否已經安裝cmake
cmake --version
如果安裝了,並且版本低,首先進行卸載
sudo apt-get autoremove cmake
如果出現下面錯誤提示,那說明你沒有卸載哦~
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/usr/local/share/cmake-3.5
CMake Error: Error executing cmake::LoadCache(). Aborting.
2、安裝新版本
1、下載地址(版本自己選哦) https://cmake.org/download/ 下載好之後進入到該下載文件的目錄下 2、安裝
./bootstrap --prefix=/usr
make
sudo make install
3、检查
cmake --version