我对Linux和C++都是新手,我试图安装cmake,当我尝试使用sudo apt install cmake安装它时,它安装了cmake3.10,但是这里说明至少需要3.15版:当我试图使用sudo snap install cmake安装更新版本时,Linux终端暗示我得到了一个错误cannot install "cmake" Post https://api.snapcraft.io/v2/snaps/refresh:dial tcp: lookup api.snapcraft.io: no such host,可能错误是由于我在虚拟机上使用Ubuntu18.04而我没有互联网访问它。因此,我尝试从cmake.sh安装这里,并通过C4/Linux共享文件夹将其传输到Ubuntu,但没有帮助。
发布于 2020-09-23 14:21:14
要安装更新版本的cmake,请执行以下步骤:
Remove旧版本的cmake:
sudo apt remove --purge cmake
hash -rInstall更新版本的cmake: 1-第一个方法:使用Snap
sudo snap install cmake --classic第二种方法:从源安装
sudo apt install build-essential libssl-dev
wget https://github.com/Kitware/CMake/releases/download/v3.16.5/cmake-3.16.5.tar.gz
tar -zxvf cmake-3.16.5.tar.gz
cd cmake-3.16.5
./bootstrap
make
sudo make installCheck cmake版本:
cmake --version如果您想下载不同的版本,请检查本网站
N.B:我测试了第二个方法(从源代码安装),它运行良好。
https://askubuntu.com/questions/1277186
复制相似问题