且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Cmake不能找到Python库

更新时间:2021-11-21 14:56:39

当我试图在Xubuntu 14.04 Thrusty Tahr系统上编译OpenCV 3时遇到这个问题。
在安装了所有的Python开发包后,配置过程总是返回以下消息:

I was facing this problem while trying to compile OpenCV 3 on a Xubuntu 14.04 Thrusty Tahr system. With all the dev packages of Python installed, the configuration process was always returning the message:

Could NOT found PythonInterp: /usr/bin/python2.7 (found suitable version "2.7.6", minimum required is "2.7")
Could NOT find PythonLibs (missing: PYTHON_INCLUDE_DIRS) (found suitable exact version "2.7.6")
Found PythonInterp: /usr/bin/python3.4 (found suitable version "3.4", minimum required is "3.4")
Could NOT find PythonLibs (missing: PYTHON_LIBRARIES) (Required is exact version "3.4.0")

Thrusty Tahr存储库上提供的CMake版本是2.8。
一些帖子激励我升级CMake。
我添加了一个PPA CMake仓库,安装CMake版本3.2。

The CMake version available on Thrusty Tahr repositories is 2.8. Some posts inspired me to upgrade CMake. I've added a PPA CMake repository which installs CMake version 3.2.

升级后,一切运行顺利,编译成功。

After the upgrade everything ran smoothly and the compilation was successful.