ModuleNotFoundError: No module named ‘cmake‘

突然发现cmake用不了了,我已经安装过了的,用命令查看cmake版本也不行,报错如下:

$ cmake --version

Traceback (most recent call last):
  File "/home/will/.local/bin/cmake", line 7, in 
    from cmake import cmake
ModuleNotFoundError: No module named 'cmake'

因为安装OpenFace要制定版本3.11以上,用了源码安装cmake也不行,软连接什么的都没问题,相当奇怪。

后来研究了一下,发现用pip安装了就能解决问题了
pip install cmake==3.11.4
当然了,安装时会提示很多依赖项的版本不对,比如numpy,setuptools和PyHamcrest这些,这时要考虑一下,改动版本会不会影响其他项目的程序,最好做好记录,之后如果发现有问题,还能切换回来。

twisted 18.7.0 requires PyHamcrest>=1.9.0, which is not installed.
tensorflow 1.10.0 has requirement numpy<=1.14.5,>=1.13.3, but you'll have numpy 1.18.5 which is incompatible.
tensorflow 1.10.0 has requirement setuptools<=39.1.0, but you'll have setuptools 40.2.0 which is incompatible.

把这些依赖项换成对应版本之后,就没什么问题了。
再次输入cmake --version,有返回版本信息了。

$ cmake --version
cmake version 3.11.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

你可能感兴趣的:(ISSUES,cmake)