Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在cmake中设置python版本2.7.2?_Python_Cmake - Fatal编程技术网

如何在cmake中设置python版本2.7.2?

如何在cmake中设置python版本2.7.2?,python,cmake,Python,Cmake,我有一个CMakeLists.txt,其中我必须通过使用add\u test通过一个包含测试用例的Python脚本,如下所示: add_test( NAME My_test COMMAND python ${CMAKE_CURRENT_LIST_DIR}/win_testing/test.py ) 如何使用Python 2.7.2版设置并打开“test.py”?使用模块获取要在添加测试中使用的Python可执行文件的路径 find_package(PythonInterp 2.7 REQUIR

我有一个CMakeLists.txt,其中我必须通过使用
add\u test
通过一个包含测试用例的Python脚本,如下所示:

add_test( NAME My_test COMMAND python ${CMAKE_CURRENT_LIST_DIR}/win_testing/test.py )
如何使用Python 2.7.2版设置并打开“test.py”?

使用模块获取要在
添加测试中使用的Python可执行文件的路径

find_package(PythonInterp 2.7 REQUIRED)
...
add_test(NAME My_test COMMAND ${PYTHON_EXECUTABLE} ... )

确保FindPythonInterp.cmake中调用的函数可以找到Python 2.7.2

尝试使用-DPYTHON_EXECUTABLE:FILEPATH=/path/to/python2.6进行配置