Search code examples
pythoncmakepybind11

Trouble with cmake when install pybind11


I am trying to get started with pybind11, following the documentation. I have installed pybind11 using pip. The location of the directory is:

~/anaconda3/lib/python3.6/site-packages/pybind11

The next step is to compile the test cases. According to the documentation, I should run

mkdir build

cd build

cmake ..

make check -j 4

However, when running cmake .. I get the error CMake Error: The source directory "/home/MyUserName/anaconda3/lib/python3.6/site-packages/pybind11" does not appear to contain CMakeLists.txt. So it seems that I don't have the file CMakeLists.txt in the pybind11 directory that was created by the pip install.

Any idea about what's gone wrong here?


Solution

  • When you install pybind11by using pip, you will get only the result and not the source of pybind (the py files, the include files ... ).

    To run the example, you have to checkout the sources git clone --recursive https://github.com/pybind/cmake_example.git and then run the commands according to the documentation.