问题:
在使用pip install cmake安装完cmake以后,想要检查一下cmake的版本,于是输入
cmake --version # 查看cmake的版本
结果出现如下报错:
CMake Error: Could not find CMAKE_ROOT !!!
CMake has most likely not been installed correctly.
Modules directory not found in
/home/pengzhang/anaconda3/envs/tensorflow1/share/cmake-3.19
cmake version 3.19.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
解决措施:
这个问题是由于CMake无法找到正确的安装路径。
首先,卸载现有的cmake:
pip uninstall cmake
然后,使用Anaconda提供的CMake包来安装:
conda install -c conda-forge cmake
安装完成以后即可解决问题。