cmake finds wrong python libs

前端 未结 4 2009

I\'m new to CMake and have trouble understanding some usage concepts.

I\'m calling a python script from a c++ program:

#include 
...
Py_I         


        
4条回答
  •  盖世英雄少女心
    2021-02-04 03:27

    You can tell cmake where to find this PythonLibs by specifying the path to your python libraries like this:

    cmake -DPYTHON_LIBRARIES=/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib .
    

    This will then set the ${PYTHON_LIBRARIES} inside cmake to the right path.

    To find out which other possible options (besides PYTHON_LIBRARIES) you can give to cmake (with the -DARG option) try running

    ccmake .
    

    Then press c to configure, and t for advanced options.

    For example, you might also want to set

    -DPYTHON_LIBRARY='/softwarepath/Python/Python2.7/lib/libpython2.7.so'
    -DPYTHON_INCLUDE='/softwarepath/Python/Python2.7/include'
    

提交回复
热议问题