Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

CMake error building with Python libraries

📅 2017-Jan-24 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ cmake, error, python ⬩ 📚 Archive

Problem

I got this error from CMake when building a project that needs to link with Python 3.4 libraries:

-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.4.3", minimum required is "3.0")
-- Could NOT find PythonLibs (missing:  PYTHON_LIBRARIES PYTHON_INCLUDE_DIRS) (Required is at least version "3.0")

Solution

Turns out that the CMake available on my system only supported finding Python 3 packages upto version 3.3. To change it to support Python 3.4 was possible by editing two files:

I was able to build with Python 3.x libraries after that.