我通过以下命令卸载了 cmake:
sudo apt remove cmake
sudo apt purge --auto-remove cmake
然后从 cmake 网站安装新版本。运行时,cmake --version
我得到了我已安装的版本:
cmake version 3.11.3
CMake suite maintained and supported by Kitware (kitware.com/cmake).
然而,当我再次尝试运行此命令时,似乎它仍然具有以前的版本
$ sudo apt-get install cmake
Reading package lists... Done
Building dependency tree
Reading state information... Done
cmake is already the newest version (3.5.1-1ubuntu3).
0 upgraded, 0 newly installed, 0 to remove and 28 not upgraded.
我运行了以下命令:
~$ which cmake
/usr/local/bin/cmake
~$ apt-cache policy cmake
cmake:
Installed: 3.5.1-1ubuntu3
Candidate: 3.5.1-1ubuntu3
Version table:
*** 3.5.1-1ubuntu3 500
500 http://my.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
100 /var/lib/dpkg/status
3.5.1-1ubuntu1 500
500 http://my.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
你能指导我吗?我无法安装需要更高版本 cmake 的软件。
答案1
输出which cmake
表明您的cmake
位置位于在/usr/local/bin/cmake这就是问题所在。
将其删除sudo rm /usr/local/bin/cmake
并重试。